@pinpt/ui-components
v3.0.96
Published
Pinpoint component library and house styles for React
Downloads
47
Keywords
Readme
Getting Started
- Install via npm:
npm install --save @pinpt/ui-components
- Import
global.less
into less style sheets to use house styles:
@import (reference) '@pinpt/ui-components/global.less';
Note: you may need to update the host project build configuration.
- Icon fonts must be served from
/webfonts
. Clone the project and copy them toproject_root/public/webfont
.
Usage
import React from 'react';
import { Container, Semantic } from '@pinpt/ui-components';
const { Icon: SemanticIcon } = Semantic;
class Example extends React.Component {
render () {
return (
<>
<Container>
<SemanticIcon className="user-icon user" />
</Container>
</>
);
}
}
@import (reference) '@pinpt/ui-components/global.less';
.user-icon {
color: @primary;
}
Semantic UI
Semantic UI components are limited to those used in this library (see semantic.json). To use a component not currently used, you must update the Semantic UI configuration and re-build both the Semantic UI CSS and this library.
Icon Fonts
To use icon fonts, inherit the relevant style class:
import React from 'react';
import { Semantic } from '@pinpt/ui-components';
const { Icon: SemanticIcon } = Semantic;
class Example extends React.Component {
render () {
return (
<>
<SemanticIcon className="solid-icon lock" />
</>
);
}
}
@import (reference) '@pinpt/ui-components/global.less';
.solid-icon {
.fas();
color: @primary;
}
Development
This project was created using create-react-library and is packaged using rollup.js.
For local development, link the module:
[sudo] npm link
cd path/to/app/project
npm link @pinpt/ui-components
Link to the copy of react
in the application project. E.g. for webapp-react, assuming sibling project directories:
npm link ../webapp-react/node_modules/react
For more details on why this is required see https://reactjs.org/warnings/invalid-hook-call-warning.html.
Start watching for changes:
npm run watch
Any changes made will automatically build and link the module.
Alternatively you can build the module using:
npm run build
House Styles
Global brand styles are defined in theme.less. On change, Semantic UI CSS must be generated and the module rebuilt.
Storybook
This project uses Storybook for testing components in isolation. All components should include a stories.js
file containing stories to run. To run Storybook book:
npm run storybook
Semantic UI
Semantic UI provides the underlying set of components. Sepcifically, Semantic-UI-React provides the implementation and Semantic-UI provides the themed styling. Included component styles are listed in semantic.json, to use and expose any additional component it must be added here.
The themed CSS file (semantic/semantic[.min].css
) can be generated using:
npm run build:semantic
Dependencies
Any npm dependency should be added to dependencies
and peerDependencies
in package.json. Rollup ignores modules in the peerDependencies
list and will not include these in the packaged module.
License
All of this code is proprietary and Copyright © 2017-2019 by Pinpoint Software, Inc.