0.2.0 • Published 24 days ago
@primer/react-toolchain v0.2.0
Requirements
- webpack 5+
Setup
npm install @primer/react-toolchain --save-dev
Storybook
Step 1. Add this script to your package.json
:
{
scripts: {
"start": "webpack",
"test": "jest",
+ "storybook": "prc storybook"
}
}
Step 2. Create a ComponentName.stories.tsx
file
We recommend putting this file next to the component.
import { DatePicker } from './date-picker';
export default {
title: 'Common components/Datepicker'
};
export const SimpleDatePicker = () => {
return <DatePicker variant="single" value={new Date()} />;
};
Learn more about stories from the Storybook docs
You're good to go! Run npm run storybook
.
If you need to customize your storybook config, create .storybook
directory in the root of your repository with the following files:
main.js
const defaultConfig = require('@primer/react-toolchain/storybook/main'); const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin'); module.exports = { // extend default config ...defaultConfig, // remember to include default properties while extending addons: [...defaultConfig.addons, 'storybook-addon-performance/register'], // need to customise webpack config because we use custom resolvers for helpers/util webpackFinal: (webpackConfig) => { webpackConfig.resolve.plugins = [new TsconfigPathsPlugin({ baseUrl: './src/client' })]; return config; } };
preview.js
// step 1: export defaults export * from '@primer/react-toolchain/storybook/preview'; // (optional) step 2: customise and overwrite import { decorators } from '@primer/react-toolchain/storybook/preview'; import { withPerformance } from 'storybook-addon-performance'; decorators.push(withPerformance); export { decorators };
0.0.0-20240415093423
24 days ago
0.0.0-20240415092049
24 days ago
0.0.0-20240415092019
24 days ago
0.2.0
2 years ago
0.0.0-20221005134645
2 years ago
0.0.0-20221005134517
2 years ago
0.0.0-20221005134319
2 years ago
0.0.0-20221004134457
2 years ago
0.1.1
2 years ago
0.0.0-20221004134337
2 years ago
0.0.0-20221004134238
2 years ago
0.0.0-20221004134031
2 years ago
0.0.0-20221004133354
2 years ago
0.0.0-20221004132850
2 years ago
0.0.0-20221004132804
2 years ago
0.0.0-20221004124345
2 years ago
0.1.0
2 years ago
0.0.0-20221004123508
2 years ago
0.0.0-20221004122847
2 years ago
0.0.0-20221004122725
2 years ago
0.0.0-20221004122541
2 years ago