This is a component library foundation built using Storybook 8, SASS and CSS Modules.
- Node: ^18.18.0
- React: ^18.2.0
- Clone the repo from Github:
git clone git@github.com:millnut/storybook_foundations.git
- Install NPM Node Modules by running
npm install
from the project root
Run npm run storybook
from the project root. This will run a new instance of Storybook that can be accessed from localhost:6006
.
Changes made locally are automatically compiled and the browser instance of Storybook will automaticaly refresh, hot-loading changes very quickly where possible.
Components should always be created within the src/components
folder.
You can create a new folder within src/components
that is based on the chosen name for your component. The format of this folder name, react component and story should always be PascalCase i.e. MyNewComponent
. SASS files should always be camelCase i.e. myNewComponent
Within the component folder you must create the following 3 files:
ComponentName
|_ index.tsx
|_ {ComponentName}.stories.ts
|_ {ComponentName}.module.scss
This file is where the Component Structure is defined.
This file allows developers to pass in mockup content to the component that will render within Storybook. More information is available in the Storybook docs Storybook JS - Defining Stories
This is where component styling is defined using SASS/CSS.