1.0.0 • Published 8 years ago
registers-react-library v1.0.0
registers-react-library
React library for common components across Registers user interfaces. We have taken some of the external ONS patterns from the ons-pattern-library-starter repository and wrapped them in dynamic React components.
This tutorial was used to help setup up the project.
Using this Module
- Install the module using NPM.
npm install --save registers-react-library- Import the component you want to use.
import { Button } from 'registers-react-library';- Check the storybook for details of what props to pass in.
Environment Setup
Install NPM, it is included with Node.js (Download)
Testing the module locally
- Clone this repository
git clone https://github.com/ONSdigital/registers-react-library.git- Install the local
registers-react-librarymodule
npm install --save /path/to/registers-react-library- Import the component you want to use
import { Button } from 'registers-react-library';
<Button
id="logoutButton"
size="thin"
text="Logout"
onClick={() => alert('Clicked logout button...')}
ariaLabel="Logout Button"
type="submit"
/>- When you make changes to
registers-react-library, make sure you run thenpm installcommand from step 2 again.
Running the Storybook
npm run storybookYou can access the storybook at localhost:9001.
Deploy the Storybook to Github Pages
npm run build-storybook
npm run deploy-storybookYou can access the deployed Storybook here.
Testing
To run the Enzyme tests (using Jest as a test runner), run the following command:
npm run testLinting
To run the linter, run the following command:
npm run lintContributing
See CONTRIBUTING for details.
License
Copyright © 2017, Office for National Statistics (https://www.ons.gov.uk)
Released under MIT license, see LICENSE for details.