4.10.1 ā€¢ Published 4 months ago

@gbg/gbgcomponentlibrary_react v4.10.1

Weekly downloads
294
License
ISC
Repository
-
Last release
4 months ago

GBG Component Library for React

Usage

First, install the GBG component library and GBG component library using the package manager of your choice

# yarn
yarn add @gbg/gbgcomponentlibrary @gbg/gbgcomponentlibrary_react

# npm
npm install @gbg/gbgcomponentlibrary @gbg/gbgcomponentlibrary_react

You must include the GBG component library css files and assets in your React App when using these components, e.g.

// Main.jsx
import React from 'react';
import App from './app';
import '@gbg/gbgcomponentlibrary/dist/gbgcomponentlibrary.min.css';

...

Then in your React display components include the library components you wish to use

// MyCustomButton.jsx
import React from "react";
import { Button, ButtonKind } from "@gbg/gbgcomponentlibrary_react";

const MyCustomButton = ({ onClick, children }) => (
  <Button kind={ButtonKind.Tertiary} onClick={onClick}>
    {children}
  </Button>
);

export default MyCustomButton;

For a full list of exported components please visit https://ds.gbgplc.com/react/

Contributing

Pre-requisites

node v14 is required to develop in this repository - we reccomend using a node version manager, we like nvm, but your environment is your environment!

Setting up your environment

First ensure you have cloned this repository and installed the requirements using npm ci in your terminal.

Ensure that you have storybook running with npm run storybook and your tests are running npm run test:watch

Creating new components.

New components should conform to the GBG Design System and should follow the principles of writing tests to cover component use cases of inversion of control.

Our components are organised following atomic design, so should be organised under Atoms, Molecules, Templates and Base

Anatomy of a component

Each component should follow this structure

šŸ“‚ MyComponent/ // Note the capitalisation
| šŸ“„ MyComponent.snippets.js // usage code snippets
| šŸ“„ MyComponent.stories.tsx // examples for storybook
| šŸ“„ MyComponent.test.tsx    // the tests for your components
| šŸ“„ MyComponent.tsx         // the file containing your component and type definitions
| šŸ“„ index.tsx               // the public exports for this component

All components should be exported from the root index file (src/index.ts), and the index file for it's organising folder (eg. src/Atoms/Atoms.ts)

Your component must include storybook stories and have complete usecase coverage in its test cases.

Do not include the global GBGComponentLibrary.css file in your component!

Testing your component

Ensure that your tests cover

  1. Basic accessibilty tests.
it("should not have basic a11y issues", async () => {
  const { container } = render(<MyComponent />);
  const results = await axe(container);
  expect(results).toHaveNoViolations();
});
  1. Cover the use cases for your component. Think about how you would want to use this component in your projects, write tests that prove it works this way.

If you find you are writing complex tests or too many tests, you trying to do too much with this component? Could this component be broken into smaller units?

Submitting your changes

When you are ready to contribute your changes, ensure that you have a clear, clean branch containing only the changes you wish to contribute, and that the tests are passing for your component, push this branch and Raise a PR.

Raising a PR

Ensure that your PR includes the following

  • A clear title.
  • What is your PR doing.
  • A clear description of the problem you are trying to solve.
  • Any notes to help the reviewer.

It must include tests covering your changes.

4.10.1

4 months ago

4.9.0

7 months ago

4.5.5

10 months ago

4.10.0

6 months ago

4.8.1

8 months ago

4.8.0

8 months ago

4.8.3

8 months ago

4.8.2

8 months ago

4.7.0

10 months ago

4.6.1

10 months ago

4.6.0

10 months ago

4.6.3

10 months ago

4.6.2

10 months ago

4.5.0

11 months ago

4.5.2

10 months ago

4.5.1

10 months ago

4.4.3

11 months ago

4.4.4

11 months ago

4.1.5-beta.1

1 year ago

4.4.1

1 year ago

4.4.0

1 year ago

4.4.2

1 year ago

4.3.0

1 year ago

4.2.1

1 year ago

4.2.0

1 year ago

4.1.4-beta.1

1 year ago

4.1.6

1 year ago

4.1.5

1 year ago

4.1.2

1 year ago

3.40.0

1 year ago

4.0.0-beta.1

1 year ago

4.0.1-beta.1

1 year ago

4.1.0

1 year ago

4.1.1

1 year ago

3.39.0

1 year ago

3.38.2

1 year ago

3.38.1

1 year ago

3.36.0

2 years ago

3.35.0

2 years ago

3.37.0

1 year ago

3.37.1

1 year ago

3.37.2

1 year ago

3.38.0

1 year ago

3.34.0

2 years ago

3.34.1

2 years ago

3.32.4

2 years ago

3.33.0

2 years ago

3.33.1

2 years ago

3.31.0

2 years ago

3.28.0

2 years ago

3.28.2

2 years ago

3.28.1

2 years ago

3.28.3

2 years ago

3.32.0

2 years ago

3.32.1

2 years ago

3.32.2

2 years ago

3.25.3

2 years ago

3.29.0

2 years ago

3.26.0

2 years ago

3.30.0

2 years ago

3.27.0

2 years ago

3.24.0

2 years ago

3.24.9

2 years ago

3.24.2

2 years ago

3.24.1

2 years ago

3.24.4

2 years ago

3.24.3

2 years ago

3.24.6

2 years ago

3.24.5

2 years ago

3.24.8

2 years ago

3.24.7

2 years ago

3.25.1

2 years ago

3.25.0

2 years ago

3.25.2

2 years ago

3.21.1

2 years ago

3.21.2

2 years ago

3.22.0

2 years ago

3.22.1

2 years ago

3.23.1

2 years ago

3.23.0

2 years ago

3.20.0

2 years ago

3.20.2

2 years ago

3.20.1

2 years ago

3.17.1

2 years ago

3.18.1

2 years ago

3.18.0

2 years ago

3.18.2

2 years ago

3.19.0

2 years ago

3.17.0

3 years ago

3.14.0

3 years ago

3.15.0

3 years ago

3.15.2

3 years ago

3.15.1

3 years ago

3.16.0

3 years ago

3.13.0

3 years ago

3.12.0

3 years ago

3.11.0

3 years ago

3.10.1

3 years ago

3.10.0

3 years ago

3.9.2

3 years ago

3.9.1

3 years ago

3.9.0

3 years ago

3.8.0

3 years ago

3.7.3

3 years ago

3.7.2

3 years ago

3.7.1

3 years ago

3.6.2

3 years ago

3.6.3

3 years ago

3.7.0

3 years ago

3.4.0

3 years ago

3.6.1

3 years ago

3.6.0

3 years ago

3.3.10

3 years ago

3.5.3

3 years ago

3.5.0

3 years ago

3.3.9

3 years ago

3.3.7

3 years ago

3.3.6

3 years ago

3.3.5

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.3.4

3 years ago

3.3.3

3 years ago

3.3.2

3 years ago

3.2.6

3 years ago

3.2.5

3 years ago

3.2.4

3 years ago

3.2.3

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.2

3 years ago

3.0.0

3 years ago

2.11.0

3 years ago

2.9.1

3 years ago

2.10.0

3 years ago

2.9.0

3 years ago

2.8.3

3 years ago

2.8.2

3 years ago

2.8.1

3 years ago

2.8.0

3 years ago

2.7.1

3 years ago

2.7.0

3 years ago

2.6.1

3 years ago

2.5.0

3 years ago

2.6.0

3 years ago

2.4.0

3 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.0

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.16.3

3 years ago

1.16.2

3 years ago

1.16.4

3 years ago

1.16.1

4 years ago

1.16.0

4 years ago

1.15.1

4 years ago

1.15.0

4 years ago

1.14.1

4 years ago

1.14.0

4 years ago

1.13.0

4 years ago

1.12.0

4 years ago

1.11.0

4 years ago

1.10.0

4 years ago

1.9.4

4 years ago

1.9.4-beta.1

4 years ago

1.9.3-beta.1

4 years ago

1.9.2-beta.1

4 years ago

1.9.1-beta.1

4 years ago

1.9.0-beta.1

4 years ago

1.8.0-beta.1

4 years ago

1.6.0-beta.1

4 years ago

1.5.1-beta.1

4 years ago

1.5.0-beta.1

4 years ago

1.4.0-beta.1

4 years ago

1.2.1-beta.1

4 years ago

1.1.0-beta.1

4 years ago

1.0.0-beta.1

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago