First of all, welcome and thank you for contributing to our Storybook.
The purpose of our @dhi/react-components-lab GitHub library is to host the components that are not yet ready to be added to the core library. Here, the components will leave for a certain amount if time until the components have been tested by our maintainers in terms of missing features, bugs, API design etc. The older and more used a component is, the less likely it is that new issues will be found.
A lab component with low usage either means that it isn't fully working yet or that there is a low demand for it.
To get started follow these steps:
- Clone the repository`.
- Install dependencies
yarn install. - Change your working directory to
packages/react-components-lab
The package uses ESLint with the airbnb-typescript configuration, which enforces consistent code style and warns on possible errors.
Most editors support an ESLint plugin or extension. Enabling auto-fix on save may also be a good idea.
We are using the Angular Commit Message Conventions for versioning our packages.
| Commit messages | Release type |
|---|---|
| fix(name): Commit message | Patch Release 0.0.1 |
| feat(name): Commit message | Feature Release 0.1.0 |
| perf(name): Commit message | Breaking Release 1.0.0 |
Each of these commits will trigger a specific semantic versioning action when in the pipeline, so use with precaution.
fix/branch-name- When dealing with a bug or a quick-fixfeature/branch-name- When dealing with a featuredocs/branch-name- When dealing with the documentation
When creating a new feature, its necessity and value should initially be evaluated. This is done by creating an issue and describing how does the feature improve our current lab package and what is the expected behaviour, assign somebody to it and label it accordingly.
In order for a component to be added, it needs to check a few boxes:
- The component cannot be implemented by styling a Material UI component via the theme (for instance
<Button />or<Typography />). However, if the styling is complex enough and requires a lot of styling (for instance The<Slider />component), it can be evaluated. - The component implements an element of the DHI Design Guidelines or is otherwise generic enough in functionality and close enough to the DHI CVI that it is likely to find reuse in other projects.
- The component needs to be reviewed by at least one of the maintainers.
The structure, style and conventions of a component should generally be as consistent as possible. Some aspects are enforced by the ESLint configuration, but not all. It may therefore be a good idea to take a look at the existing components and follow what's established there.
Early iterations of a component may still be acceptable as it can later be revised and stabilized once the component is to be moved to the core package.
Components must be as atomic as possible. If a child component could potentially be used independently, it should be its own component, not a sub-component. Sub-components, along with their types and styles should always be exported.
When creating a PR, please explain the functionality of the component and make sure to link the relevant GitHub issues.
Moreover, ensure that you are going through the PR template instructions.
- dependencies
Inside the dependencies we want to include all the production external libraries we are using. The whole concept around it is that when a developer installs our package, npm needs to know what other dependecies to install inside node_modules, without requiring the developer to install it inside it's own app dependencies.
- peerDependencies
The peerDependencies are the dependencies that the developers using our package need to install alongside our package.
- devDependencies
While developing, we are primarily using the devDependencies to develop the library. Any dependencies that are needed for the development should be added here.
Components and all other consumable files should be exported in src/index.ts
If the file has a default export, use the following syntax: export { default as ComponentName } from 'src/components/ComponentName/ComponentName';
If the file has one or more named exports, use the following syntax export * from 'src/components/ComponentName/ComponentName';
If the file contains both a default and named exports, use both of the above.
- to be added
Thank you for contributing!