Skip to content

Commit 984e4c3

Browse files
committed
Upgrade to Storybook 6
1 parent ea6c3dd commit 984e4c3

Some content is hidden

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

69 files changed

+7024
-5342
lines changed

.storybook/config.js

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

.storybook/main.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
module.exports = {
2-
addons: ['@storybook/addon-storysource'],
3-
};
2+
"stories": [
3+
"../stories/*.stories.@(ts|tsx)",
4+
"../stories/**/*.stories.@(ts|tsx)"
5+
],
6+
"addons": [
7+
"@storybook/addon-links",
8+
"@storybook/addon-essentials",
9+
"@storybook/preset-scss"
10+
],
11+
}

.storybook/manager.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { addons } from "@storybook/addons";
2+
import nhsTheme from "./theme";
3+
4+
addons.setConfig({
5+
theme: nhsTheme
6+
});

.storybook/preview.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import "./storybook.scss";
2+
3+
export const parameters = {
4+
actions: { argTypesRegex: "^on[A-Z].*" },
5+
}
6+

.storybook/theme.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
1-
import { create } from '@storybook/theming';
1+
import { create } from "@storybook/theming/create";
2+
const version = require("../package.json").version;
23

34
export default create({
4-
base: 'light',
5-
background: 'white',
6-
colorPrimary: '#005eb8',
7-
colorSecondary: '#425563',
5+
base: 'light',
6+
background: 'white',
7+
colorPrimary: '#005eb8',
8+
colorSecondary: '#425563',
89

9-
// UI
10-
appBg: 'white',
11-
appContentBg: 'white',
12-
appBorderColor: 'grey',
13-
appBorderRadius: 4,
10+
// UI
11+
appBg: 'white',
12+
appContentBg: 'white',
13+
appBorderColor: 'grey',
14+
appBorderRadius: 4,
1415

15-
// Typography
16-
fontBase: '"Frutiger W01", Arial, sans-serif',
17-
fontCode: 'monospace',
16+
// Typography
17+
fontCode: 'monospace',
1818

19-
// Text colors
20-
textColor: '#212b32',
21-
textInverseColor: 'white',
19+
// Text colors
20+
textColor: '#212b32',
21+
textInverseColor: 'white',
2222

23-
// Toolbar default and active colors
24-
barTextColor: 'rgba(255,255,255,0.8)',
25-
barSelectedColor: 'rgba(255,255,255,1)',
26-
barBg: '#005eb8',
23+
// Toolbar default and active colors
24+
barTextColor: 'rgba(255,255,255,0.8)',
25+
barSelectedColor: 'rgba(255,255,255,1)',
26+
barBg: '#005eb8',
2727

28-
// Form colors
29-
inputBg: 'white',
30-
inputBorder: '#425563',
31-
inputTextColor: '#212b32',
32-
inputBorderRadius: 4,
28+
// Form colors
29+
inputBg: 'white',
30+
inputBorder: '#425563',
31+
inputTextColor: '#212b32',
32+
inputBorderRadius: 4,
3333

34-
brandTitle: 'NHS.UK React Components',
35-
brandUrl: 'https://beta.nhs.uk/service-manual/',
36-
brandImage: 'https://assets.nhs.uk/images/nhs-logo.png',
34+
brandTitle: `NHS.UK React Components (v${version})`,
35+
brandUrl: 'https://github.com/NHSDigital/nhsuk-react-components'
3736
});

.storybook/webpack.config.js

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

package.json

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@
1313
"@babel/plugin-proposal-numeric-separator": "^7.10.1",
1414
"@babel/preset-react": "^7.10.1",
1515
"@babel/preset-typescript": "^7.10.1",
16-
"@storybook/addon-centered": "^5.3.19",
17-
"@storybook/addon-info": "^5.3.19",
18-
"@storybook/addon-storysource": "^5.3.19",
19-
"@storybook/react": "^5.3.19",
20-
"@storybook/storybook-deployer": "^2.8.6",
16+
"@storybook/addon-actions": "^6.0.28",
17+
"@storybook/addon-essentials": "^6.0.28",
18+
"@storybook/addon-links": "^6.0.28",
19+
"@storybook/addon-storysource": "^6.0.28",
20+
"@storybook/preset-scss": "^1.0.3",
21+
"@storybook/react": "^6.0.28",
22+
"@storybook/storybook-deployer": "^2.8.7",
2123
"@types/classnames": "^2.2.9",
2224
"@types/enzyme": "^3.10.3",
2325
"@types/enzyme-adapter-react-16": "^1.0.5",
2426
"@types/jest": "^24.0.23",
2527
"@types/jest-axe": "^3.2.2",
26-
"@types/node": "^12.12.12",
2728
"@types/react": "^16.9.3",
2829
"@types/react-dom": "^16.9.3",
2930
"@typescript-eslint/eslint-plugin": "^2.3.1",
3031
"@typescript-eslint/parser": "^2.3.1",
3132
"awesome-typescript-loader": "^5.2.1",
3233
"babel-loader": "^8.0.6",
34+
"css-loader": "^5.0.0",
3335
"enzyme": "^3.10.3",
3436
"enzyme-adapter-react-16": "^1.15.1",
3537
"enzyme-to-json": "^3.4.3",
@@ -43,20 +45,22 @@
4345
"eslint-plugin-prettier": "^3.1.1",
4446
"eslint-plugin-react": "^7.14.3",
4547
"eslint-plugin-react-hooks": "^1.7.0",
46-
"jest": "^24.9.0",
48+
"jest": "^26.6.1",
4749
"jest-axe": "^3.4.0",
4850
"nhsuk-frontend": "^3.1.0",
4951
"node-sass": "^4.14.1",
5052
"prettier": "^1.18.2",
5153
"react": "^16.9.3",
5254
"react-docgen-typescript-loader": "^3.2.1",
5355
"react-dom": "^16.9.3",
56+
"react-is": "^17.0.1",
5457
"rollup": "^1.21.4",
5558
"rollup-plugin-sass": "^1.2.2",
5659
"rollup-plugin-scss": "^1.0.2",
5760
"rollup-plugin-typescript2": "^0.24.2",
58-
"sass-loader": "^8.0.2",
59-
"ts-jest": "^24.2.0",
61+
"sass-loader": "^10.0.4",
62+
"style-loader": "^2.0.0",
63+
"ts-jest": "^26.4.3",
6064
"ts-node": "^8.4.1",
6165
"tslib": "^2.0.0",
6266
"typescript": "^3.9.5"
@@ -70,7 +74,7 @@
7074
"classnames": "^2.2.6"
7175
},
7276
"scripts": {
73-
"storybook": "start-storybook",
77+
"storybook": "start-storybook -p 6006 --no-dll",
7478
"cleanup": "bash scripts/cleanup.sh",
7579
"build": "yarn cleanup && yarn build:dist && yarn build:lib",
7680
"build:dist": "rollup -c",
@@ -79,7 +83,8 @@
7983
"test:ci": "jest --coverage",
8084
"test:watch": "jest --watch",
8185
"lint": "eslint --fix -c .eslintrc.js --ext .ts --ext .tsx src/*.ts src/components/**/*.ts src/util/*.ts",
82-
"prebuild": "yarn lint && yarn test --coverage"
86+
"prebuild": "yarn lint && yarn test --coverage",
87+
"build-storybook": "build-storybook --no-dll"
8388
},
8489
"files": [
8590
"dist",

src/components/checkboxes/Checkboxes.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Checkboxes extends PureComponent<CheckboxesProps, CheckboxesState> {
2121

2222
private boxIds: Record<string, string> = {};
2323

24-
constructor(props: {}, ...rest: any[]) {
25-
super(props, ...rest);
24+
constructor(props: {}) {
25+
super(props);
2626
this.state = {
2727
conditionalBoxes: [],
2828
};

src/components/date-input/DateInput.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class DateInput extends PureComponent<DateInputProps, DateInputState> {
4444

4545
static Year = YearInput;
4646

47-
constructor(props: DateInputProps, ...rest: any[]) {
48-
super(props, ...rest);
47+
constructor(props: DateInputProps) {
48+
super(props);
4949
this.state = {
5050
values: {
5151
day: props.value?.day || '',
@@ -113,7 +113,6 @@ class DateInput extends PureComponent<DateInputProps, DateInputState> {
113113
if (inputType === 'year') this.yearRef = ref;
114114
};
115115

116-
117116
render() {
118117
const { children, onChange, value, defaultValue, ...rest } = this.props;
119118

src/components/fieldset/Fieldset.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ interface FieldsetProps extends HTMLProps<HTMLFieldSetElement> {
5050
type FieldsetState = { registeredComponents: Array<string>; erroredComponents: Array<string> };
5151

5252
class Fieldset extends PureComponent<FieldsetProps, FieldsetState> {
53-
constructor(props: FieldsetProps, ...rest: any[]) {
54-
super(props, ...rest);
53+
constructor(props: FieldsetProps) {
54+
super(props);
5555
this.state = {
5656
registeredComponents: [],
5757
erroredComponents: [],

0 commit comments

Comments
 (0)