Giter VIP home page Giter VIP logo

nordnet-ui-kit's Introduction

Nordnet UI Kit

NPM version Build Status Coverage Status Dependency Status

Installation

npm install --save nordnet-ui-kit # or
yarn add nordnet-ui-kit

Usage

// src/root.js
import { ThemeProvider } from 'react-jss';
import { theme } from 'nordnet-ui-kit';
import App from './App'

const Root = (
  <ThemeProvider theme={theme}>
    <App />
  </ThemeProvider>
);
ReactDOM.render(Root, document.getElementById('app'));

// src/App.js
import { Button } from 'nordnet-ui-kit';

const App = props => (
  <div>
    <Button variant="primary" modifier="success">
      Success
    </Button>
  </div>
);

export default App;

To see what is exported from nordnet-ui-kit, please see the documentation below or index.js

Compatibility

  • v1.5.1 and lower depends on jss-theme-reactor and jss@7
  • v1.6.0+ depends on @iamstarkov/jss-theme-reactor and jss@8, so please update your components to use @iamstarkov/jss-theme-reactor instead of jss-theme-reactor
  • v1.7.0+ depends on react-jss and jss@8, so please update your components to use react-jss instead of @iamstarkov/jss-theme-reactor. Also, v1.7.0 deprecates exported ThemeProvider, createShallow and createMount. It will be removed in next major release. Read more in v1.7.0 migration docs
  • v1.7.0 also features react-jss over jss-theme-reactor, please read how to migrate your components.
  • We can't expect all components to be rewritten to react-jss instantly, so you will need to use both jss-theme-reactor based component and react-jss components at the same time, read in the jss-theme-reactor migration docs how to do it.

Documentation for the latest release is available here.

Documentation about how to write, style and test components is availible in the docs folder

Developing

Developing workflow can be found in the contributing guidelines.

Contributing

Everyone is welcome to contribute. Please take a moment to review the contributing guidelines.

License

This open source project released by Nordnet is licensed under the MIT license.

MIT (http://www.opensource.org/licenses/mit-license.php)

nordnet-ui-kit's People

Contributors

adriansun avatar amerjx avatar anncos avatar anneback avatar bstream avatar dhq avatar dimchez avatar esundqvist avatar filipstenbeck avatar gish avatar gu5taf avatar iamstarkov avatar jacobblomgren avatar jcb-k avatar jesperwiner avatar johankitti avatar johnlindahltech avatar kitsunekelso avatar macber avatar mjmonline avatar mlenser avatar myoxocephalus avatar renovate[bot] avatar robineng avatar robsan-nordnet avatar sievertknorrblad avatar stigdanielek avatar unic0arn avatar wemstad avatar willeeklund avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nordnet-ui-kit's Issues

Checkbox </3 redux-form

The <Checkbox/> does not currently work with Redux-Form, I think the problem is the custom onChangeHandler in checkbox somehow. Will look into it and define what I'm exactly missing.

How to handle font?

The designated font is not available out of the box. Please make an instructional of how to include it in our project.

FR: Logotype

It would be nice to have a component for Nordnet Logotype. For easy changing in the future.

Add <Flag /> component

SVG flags component (with our supported markets) (support for inline rendering would be nice, see #79)

Main markets:

  • Sweden
  • Norway
  • Finland
  • Denmark
  • USA
  • Canada
  • Germany

Example use:
image

Translatable Labels etc

It would be nice if we don't have to pass around hardcoded strings to Input's and other elements. We want Intl and translation elements!

FR: Tables

We need Table-components. Please make them look fancy in print aswell.

Input not listening for programatically changed values

Something like

<Input value={this.state.test}/>
<button onClick={()=>this.setState({test:'Test'})}>Click</button>

Will not update the presented value in the input. (The code is valid for a native <input/>.)

This is of course just a quick gist, it does not matter if the data is incoming from the props.

add getting started

just how to get started using bundle overall and each component separately

<Input type="select" .. /> throws warnings in React > 15.2.1 due to unknown prop `options`

Since props is passed to the DOM node like {...props} it means that it will receive some props only intended for react as attributes (see https://facebook.github.io/react/warnings/unknown-prop.html).

Warning reads:

Warning: Unknown prop `options` on <select> tag. Remove this prop from the element.

There is another one of these issues in react-select that is fixed in the latest beta release so hopefully it will make stable soon (JedWatson/react-select#1063)

Radio not accepting bool.

I have a boolean switch with radiobuttons (this is a legal thing, I would have prefered a checkbox, but I am not allowed that):

<Radio value={true}/>
<Radio value={false}/>

This gives the following warning:

Warning: Failed propType: Invalid prop value of type boolean supplied to Radio, expected string. Check the render method of PersonForm.

Am I supposed to do another way, or is the use case bypassed?

Collapsible: Content with margin-top gets pushed down below the visible area

If I give the Collapsible a DIV whose first child has a margin-top set, the DIV will be pushed down and the lower part will end up below the bottom edge of the visible area. However, if I apply the following CSS rule:

.collapsible__body > div {
  border: 1px solid rgba(0, 0, 0, 0);
}

things will render fine. There might of course be a more elegant solution/hack for this issue, but this invisible border does the trick for me at least.

button variable type support

import { Button } from 'nordnet-ui-kit';
const randomBoolean = () => Boolean(Math.round(Math.random()));

import 'nordnet-ui-kit/dist/button/button.css';

class Example extends React.Component {
  render() {
    return (<div>
      <div>Current implementation
        randomBoolean()
          ? <Button primary> text </Button>
          : <Button seconday> text </Button>
      </div>
      <div>Proposed implementation
        <Button type={randomBoolean() ? 'primary' : 'seconday'}> text </Button>
      </div>
    </div>)
  }
}

Proposed solution seems to be a bit simpler. what do you think?

Disabled date-picker throws errors onClick

I have a disabled date-input field, when I click on the input, the console start throwing:

Uncaught TypeError: Cannot read property 'focus' of null
onClick @ index.js:391
ReactErrorUtils.invokeGuardedCallback @ vendor.bundle.2.0.1-development.js:6executeDispatch @ vendor.bundle.2.0.1-development.js:2executeDispatchesInOrder @ vendor.bundle.2.0.1-development.js:2executeDispatchesAndRelease @ vendor.bundle.2.0.1-development.js:2executeDispatchesAndReleaseTopLevel @ vendor.bundle.2.0.1-development.js:2forEachAccumulated @ vendor.bundle.2.0.1-development.js:10EventPluginHub.processEventQueue @ vendor.bundle.2.0.1-development.js:2runEventQueueInBatch @ vendor.bundle.2.0.1-development.js:6ReactEventEmitterMixin.handleTopLevel @ vendor.bundle.2.0.1-development.js:6handleTopLevelWithoutPath @ vendor.bundle.2.0.1-development.js:6handleTopLevelImpl @ vendor.bundle.2.0.1-development.js:6Mixin.perform @ vendor.bundle.2.0.1-development.js:9ReactDefaultBatchingStrategy.batchedUpdates @ vendor.bundle.2.0.1-development.js:5batchedUpdates @ vendor.bundle.2.0.1-development.js:8ReactEventListener.dispatchEvent @ vendor.bundle.2.0.1-development.js:6

index.js:391

 if (!_this2.state.hasFocus) document.querySelector('#' + id).focus();

context:

          return _react2.default.createElement(
            'div',
            { className: classes },
            _react2.default.createElement(
              'div',
              {
                className: 'input__date',
                onClick: function onClick() {
                  if (!_this2.state.hasFocus) document.querySelector('#' + id).focus();
                }
              },
              units.map(function (unit, index) {
                return _react2.default.createElement(
                  'span',
...

Autocomplete bug

When autocomplete is active the placeholder text is overlapping.

screen shot 2016-04-28 at 16 02 23

make it easy to use px instead of rem

To make the UI kit work on the current Nordnet site we can't use rems but on anything new we should.
I added a flag to variables as well as a mixin that makes toggling between rem and px easy.

Needs to be applied everywhere, see here for how it's done.

Erasing after focus is dodgy

Given: Input has a value and is blurred.
When: Focus to input (visually is all the text selected), press backspace to remove text.
Then: Deselect text, no actual change of text.

Styling of all components into new style

List of components:

  • Alert (#156)
  • Icon (Checking this and adding strokeWidth to an enhancement #174)
  • LabeledValue (#155)
  • Badge (#157)
  • Avatar (#161)
  • Flag (Checking this and adding extensions to #180)
  • RadioGroup
  • Input (#159) (More fixes: #173)
  • Dropdown (#153)
  • Tooltip (#184)
  • Button (#158)
  • Spinner (This does not need fixing)
  • Table (#163)
  • Td (#163)
  • Tbody (#163)
  • Tfoot (#163)
  • Th (#163)
  • Thead (#163)
  • Tr (#163)
  • SegmentedControl (#168)
  • SparkGraph (Investigate how to put SparkGraph back, d3-interpolate dependency broke bundle) (#177)
  • Search (#179)
  • Pane (#175)
  • HorizontalNav (#175)
  • Widget (#175)
  • RatioBar (#175)

nordnet-ui-kit seems to break my phantomjs tests

Tried to test a component that imported nordnet-ui-kit today and when I try to test it karma crashes with this output:

PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
  SyntaxError: Parse error
  at /path/to/react-seed-light/tests.webpack.js:66887

Finished in 0.094 secs / 0 secs

SUMMARY:
โœ” 0 tests completed

Small working example:

// Component.jsx
import React from 'react';
import kit from 'nordnet-ui-kit';

export default () => <div></div>;
// __tests__/Component.test.js
import Component from '../Component.jsx';
// tests.webpack.js
require('es5-shim');
global.Promise = require('es6-promise-polyfill').Promise;

const context = require.context('./src', true, /\.test.js/);
context.keys().forEach(context);

npm test

"pretest": "npm config set react-seed-light:karma_env=coverage",
"test": "karma start",

Spinner not receiving mask

When creating a <Spinner /> it is not receiving the mask property for some reason, i.e. the default one:
mask: url("#spinner__mask--16-2-20");

Here's what the Styles tab is showing:
screenshot 2016-08-04 13 35 32

As opposed to what it should look like, and the way it does on the documentation page:
screenshot 2016-08-04 13 38 34

Input[type=number] not accepting numbers

Similiar problem as #6 but with normal inputs with HTML5 type number.

<Input type="number" value={1}/>

Warning: Failed propType: Invalid prop value of type number supplied to Input, expected string. Check the render method of ValidatedInput.

Button breaking native api

Native buttons have type = [button, reset, submit]. I need to be able to set this in my forms.
Please consider changing the current type = [danger, warning, etc]

Port components to JSS based approach

To port a component, do this:

  • Refactor scss to jss
  • Rewrite tests to use new test helpers
  • Update styling to new design
  • Add component to portedComponent array in styleguide.config.js

List of components:

  • Icon (#129)
  • LabeledValue (#120 - Redefine sizes)
  • Badge (#119 - Could need re-styling)
  • Avatar TextIcon (#122 - Add more sizes)
  • Flag (#126)
  • SparkGraph (#133)
  • RadioGroup (#134)
  • Input (#135) (outstanding: remove BEM, remove bare classes and rework transitions into theme, re-style to new design)
  • Dropdown (#137)
  • Pane (#138)
  • HorizontalNav (#140)
  • Tooltip (#139)
  • Button (#144)
  • Search (#142)
  • Table (#145)
  • Td (#145)
  • Tbody (#145)
  • Tfoot (#145)
  • Th (#145)
  • Thead (#145)
  • Tr (#145)
  • Logo (#125) (Moved into Icon as NordnetLogo) - Candidate for removal
  • RatioBar (#134)
  • Widget (#146)
  • Alert (#130)
  • Spinner

Remove these

  • Legend (#136, possible candidate for removal)
  • RangeSelector (#134, Possibly remove this, only used for graphs)
  • NavBar (#130, Remove this)
  • GraphTooltip (#128, Remove this)
  • Select (#134)

Icon: Fix for dynamic strokewidth

See how svg-icon-template-loader does it. Currently some icons are blurry in default state because of this and strokeWidth manipulation does not affect size and viewBox like it should!

Problem (both GraphCandlestick and Film icons get smudged):
image

add development section

  • for ui-kit itself
  • for documentation

how to clone, install dependencies, start development and such

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.