Skip to content

Commit 979f1de

Browse files
Storybook 9
1 parent 25704d4 commit 979f1de

File tree

148 files changed

+744
-628
lines changed

Some content is hidden

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

148 files changed

+744
-628
lines changed

dotcom-rendering/.eslintrc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ module.exports = {
6363
'eslint:recommended',
6464
'@guardian/eslint-config-typescript',
6565
'plugin:jsx-a11y/recommended',
66-
// eslint-config-prettier disables formatting rules that conflict with prettier
67-
// needs to go last so it can override other configuration. See https://github.com/prettier/eslint-config-prettier#installation
6866
'prettier',
6967
'plugin:ssr-friendly/recommended',
68+
'plugin:storybook/recommended',
7069
],
7170
parser: '@typescript-eslint/parser',
7271
parserOptions: {

dotcom-rendering/.storybook/decorators/configContextDecorator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { ConfigProvider } from '../../src/components/ConfigContext';
3-
import type { Decorator } from '@storybook/react';
3+
import type { Decorator } from '@storybook/react-webpack5';
44
import { Config } from '../../src/types/configContext';
55

66
const defaultConfig = {

dotcom-rendering/.storybook/decorators/gridDecorators.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { css } from '@emotion/react';
2-
import type { Decorator } from '@storybook/react';
2+
import type { Decorator } from '@storybook/react-webpack5';
33
import { grid } from '../../src/grid';
44
import { from } from '@guardian/source/foundations';
55

dotcom-rendering/.storybook/decorators/splitThemeDecorator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
textSans17,
1414
textSansBold20,
1515
} from '@guardian/source/foundations';
16-
import { Decorator } from '@storybook/react';
16+
import { Decorator } from '@storybook/react-webpack5';
1717
import { storybookPaletteDeclarations as paletteDeclarations } from '../mocks/paletteDeclarations';
1818
import type { ReactNode } from 'react';
1919

dotcom-rendering/.storybook/decorators/themeDecorator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
type Decorator,
1212
type StoryContext,
1313
type StrictArgs,
14-
} from '@storybook/react';
14+
} from '@storybook/react-webpack5';
1515
import { ArticleFormat } from '../../src/lib/articleFormat';
1616
import type { CSSProperties } from 'react';
1717

dotcom-rendering/.storybook/main.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import { svgr } from '../webpack/svg.cjs';
99
saveStories();
1010

1111
const config: StorybookConfig = {
12-
features: {},
12+
features: {
13+
actions: true,
14+
backgrounds: true,
15+
controls: true,
16+
viewport: true,
17+
toolbars: true,
18+
},
1319

1420
stories: [
1521
'../src/**/*.stories.@(tsx)',
@@ -23,21 +29,7 @@ const config: StorybookConfig = {
2329
{ from: '../src/static', to: '/static/frontend/' },
2430
],
2531

26-
addons: [
27-
{
28-
name: '@storybook/addon-essentials',
29-
options: {
30-
actions: true,
31-
backgrounds: true,
32-
controls: true,
33-
docs: true,
34-
viewport: true,
35-
toolbars: true,
36-
},
37-
},
38-
'@storybook/addon-interactions',
39-
'@storybook/addon-webpack5-compiler-swc',
40-
],
32+
addons: ['@storybook/addon-webpack5-compiler-swc', '@storybook/addon-docs'],
4133

4234
webpackFinal: async (config) => {
4335
// Get project specific webpack options

dotcom-rendering/.storybook/preview.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Picture } from '../src/components/Picture';
1212
import { mockFetch } from '../src/lib/mockRESTCalls';
1313
import { setABTests } from '../src/lib/useAB';
1414
import { ConfigContextDecorator } from './decorators/configContextDecorator';
15-
import { Preview } from '@storybook/react';
15+
import { Preview } from '@storybook/react-webpack5';
1616
import {
1717
globalColourScheme,
1818
globalColourSchemeDecorator,
@@ -162,9 +162,15 @@ export default {
162162

163163
parameters: {
164164
viewport: {
165-
viewports: guardianViewports,
166-
defaultViewport: 'wide',
165+
options: guardianViewports,
167166
},
168167
layout: 'fullscreen',
169168
},
169+
170+
initialGlobals: {
171+
viewport: {
172+
value: 'wide',
173+
isRotated: false,
174+
},
175+
},
170176
} satisfies Preview;

dotcom-rendering/.storybook/toolbar/globalColourScheme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Decorator } from '@storybook/react';
1+
import type { Decorator } from '@storybook/react-webpack5';
22
import { lightDecorator, darkDecorator } from '../decorators/themeDecorator';
33
import { splitTheme } from '../decorators/splitThemeDecorator';
44
import {

dotcom-rendering/package.json

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,8 @@
4747
"@guardian/tsconfig": "0.2.0",
4848
"@playwright/test": "1.52.0",
4949
"@sentry/browser": "10.10.0",
50-
"@storybook/addon-essentials": "8.6.14",
51-
"@storybook/addon-interactions": "8.6.14",
52-
"@storybook/addon-webpack5-compiler-swc": "3.0.0",
53-
"@storybook/components": "8.6.14",
54-
"@storybook/core-events": "8.6.14",
55-
"@storybook/manager-api": "8.6.14",
56-
"@storybook/preview-api": "8.6.14",
57-
"@storybook/react": "8.6.14",
58-
"@storybook/react-webpack5": "8.6.14",
59-
"@storybook/test": "8.6.14",
60-
"@storybook/theming": "8.6.14",
50+
"@storybook/addon-webpack5-compiler-swc": "4.0.1",
51+
"@storybook/react-webpack5": "9.1.10",
6152
"@svgr/webpack": "8.1.0",
6253
"@swc/cli": "0.7.7",
6354
"@swc/core": "1.11.31",
@@ -153,7 +144,7 @@
153144
"screenfull": "6.0.2",
154145
"semver": "7.5.4",
155146
"source-map": "0.7.4",
156-
"storybook": "8.6.14",
147+
"storybook": "9.1.10",
157148
"stylelint": "16.5.0",
158149
"stylelint-config-recommended": "14.0.0",
159150
"swc-loader": "0.2.6",
@@ -184,5 +175,9 @@
184175
"webpack-node-externals": "3.0.0",
185176
"webpack-sources": "3.2.3",
186177
"zod": "3.22.4"
178+
},
179+
"devDependencies": {
180+
"eslint-plugin-storybook": "9.1.10",
181+
"@storybook/addon-docs": "9.1.10"
187182
}
188183
}

dotcom-rendering/src/components/Accessibility.importable.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Meta, StoryObj } from '@storybook/react';
1+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
22
import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator';
33
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
44
import { Accessibility as AccessibilityComponent } from './Accessibility.importable';

0 commit comments

Comments
 (0)