Skip to content

Commit 875a0a6

Browse files
authored
Migrate to Storybook v7 (#139)
* Migrate to Storybook v7 All components to CSF3 * Gitignore idea files * Add Docs pages * Move docs pages from repo into root level story docs where available * Move all component stories into new subfolder for components * Add existing markdown docs as docstrings instead to maintain autodoc layout * Default to Welcome.mdx * Fieldset duplicate heading * Update storybook RC to stable v7 release
1 parent 9b37a97 commit 875a0a6

File tree

102 files changed

+6909
-8142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+6909
-8142
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,6 @@ dist
110110
lib/
111111
yarn-error.log
112112
storybook-static/
113+
114+
# IDEA files
115+
.idea/

.storybook/main.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { StorybookConfig } from '@storybook/react-vite';
2+
const config: StorybookConfig = {
3+
stories: ['../stories/**/*.stories.@(ts|tsx)', '../stories/**/*.mdx'],
4+
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
5+
framework: {
6+
name: '@storybook/react-vite',
7+
options: {},
8+
},
9+
docs: {
10+
autodocs: true,
11+
},
12+
};
13+
export default config;

.storybook/preview.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

.storybook/preview.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import './storybook.scss';
2+
import { Preview } from '@storybook/react';
3+
4+
const preview: Preview = {
5+
parameters: {
6+
actions: { argTypesRegex: '^on[A-Z].*' },
7+
options: {
8+
storySort: {
9+
order: ['Welcome', 'Migration Guides', 'Components', 'FormBehaviour', 'Deprecated'],
10+
},
11+
},
12+
},
13+
};
14+
export default preview;

.storybook/theme.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

.storybook/theme.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { create } from '@storybook/theming/create';
2+
const version = require('../package.json').version;
3+
4+
export default create({
5+
base: 'light',
6+
7+
colorPrimary: '#005eb8',
8+
colorSecondary: '#768692',
9+
10+
// UI
11+
appBg: 'white',
12+
appContentBg: 'white',
13+
appBorderColor: 'grey',
14+
appBorderRadius: 4,
15+
16+
// Typography
17+
fontCode: 'monospace',
18+
19+
// Text colors
20+
textColor: '#212b32',
21+
textInverseColor: 'white',
22+
23+
// Toolbar default and active colors
24+
barTextColor: 'rgba(255,255,255,0.8)',
25+
barSelectedColor: 'rgba(255,255,255,1)',
26+
barBg: '#005eb8',
27+
28+
// Form colors
29+
inputBg: 'white',
30+
inputBorder: '#425563',
31+
inputTextColor: '#212b32',
32+
inputBorderRadius: 4,
33+
34+
brandTitle: `NHS.UK React Components (v${version})`,
35+
brandUrl: 'https://github.com/NHSDigital/nhsuk-react-components',
36+
});

package.json

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@
99
"license": "MIT",
1010
"devDependencies": {
1111
"@babel/cli": "^7.13.16",
12-
"@babel/core": "^7.14.0",
12+
"@babel/core": "^7.19.6",
1313
"@rollup/plugin-commonjs": "^19.0.0",
1414
"@rollup/plugin-node-resolve": "^13.0.0",
15-
"@storybook/addon-actions": "^6.2.9",
16-
"@storybook/addon-essentials": "^6.2.9",
17-
"@storybook/addon-links": "^6.2.9",
18-
"@storybook/react": "^6.2.9",
19-
"@storybook/storybook-deployer": "^2.8.7",
15+
"@storybook/addon-actions": "^7.0.2",
16+
"@storybook/blocks": "^7.0.2",
17+
"@storybook/addon-essentials": "^7.0.2",
18+
"@storybook/addon-links": "^7.0.2",
19+
"@storybook/addons": "^7.0.2",
20+
"@storybook/preview-web": "^7.0.2",
21+
"@storybook/react": "^7.0.2",
22+
"@storybook/react-vite": "^7.0.2",
23+
"@storybook/storybook-deployer": "^2.8.16",
24+
"@storybook/theming": "^7.0.2",
2025
"@types/enzyme": "^3.10.8",
2126
"@types/jest": "^26.0.23",
2227
"@types/jest-axe": "^3.5.1",
@@ -49,10 +54,11 @@
4954
"rollup-plugin-peer-deps-external": "^2.2.4",
5055
"rollup-plugin-typescript2": "^0.30.0",
5156
"sass": "^1.32.12",
52-
"sass-loader": "10.1.1",
57+
"storybook": "^7.0.2",
5358
"ts-jest": "^26.5.6",
5459
"ts-node": "^9.1.1",
55-
"typescript": "4.2.4"
60+
"typescript": "4.2.4",
61+
"vite": "^4.2.1"
5662
},
5763
"peerDependencies": {
5864
"nhsuk-frontend": ">=4.0.0",
@@ -62,18 +68,21 @@
6268
"dependencies": {
6369
"classnames": "^2.2.6"
6470
},
71+
"resolutions": {
72+
"@types/react": "16.14.0"
73+
},
6574
"scripts": {
6675
"cleanup": "rm -rf dist/ > /dev/null && rm -rf lib/ > /dev/null",
67-
"storybook": "start-storybook -p 6006",
76+
"storybook": "storybook dev -p 6006",
6877
"build:dist": "rollup -c",
6978
"build:lib": "NODE_ENV=production babel src --out-dir lib --extensions \".ts,.tsx\" --ignore \"**/__tests__,**/__mocks__,**/setupTests.ts\"",
7079
"build": "yarn cleanup && yarn build:dist && yarn build:lib",
7180
"test": "jest",
7281
"test:ci": "jest --coverage",
7382
"lint": "eslint 'src/**/*.{js,ts,tsx}' 'stories/**/*.{js,ts,tsx}' --fix",
7483
"lint:ci": "eslint 'src/**/*.{js,ts,tsx}' 'stories/**/*.{js,ts,tsx}'",
75-
"build-storybook": "build-storybook",
76-
"prepublishOnly": "yarn lint:ci && yarn test:ci && yarn start-storybook --smoke-test"
84+
"build-storybook": "storybook build",
85+
"prepublishOnly": "yarn lint:ci && yarn test:ci && yarn storybook --smoke-test"
7786
},
7887
"files": [
7988
"dist",

src/components/breadcrumb/README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)