Skip to content

Commit a32f180

Browse files
authored
Merge pull request #1966 from navikt/test-storybook
Storybook 🧪
2 parents 61e8f0e + 5267194 commit a32f180

File tree

155 files changed

+19094
-11046
lines changed

Some content is hidden

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

155 files changed

+19094
-11046
lines changed

Diff for: .eslintrc.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"plugins": ["css-modules", "no-relative-import-paths"],
3-
"extends": ["next/core-web-vitals", "plugin:css-modules/recommended"],
3+
"extends": [
4+
"next/core-web-vitals",
5+
"plugin:css-modules/recommended",
6+
"plugin:storybook/recommended"
7+
],
48
"ignorePatterns": ["next.config.js"],
59
"rules": {
610
"@next/next/no-img-element": 0,

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
# testing
1010
/coverage
11+
*storybook.log
12+
/storybook-static
1113

1214
# next.js
1315
/.next/

Diff for: .storybook/main.ts

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import path, { dirname, join } from 'path';
2+
import type { StorybookConfig } from '@storybook/nextjs';
3+
4+
const config: StorybookConfig = {
5+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
6+
7+
addons: [
8+
getAbsolutePath('@storybook/addon-onboarding'),
9+
getAbsolutePath('@storybook/addon-links'),
10+
getAbsolutePath('@storybook/addon-essentials'),
11+
getAbsolutePath('@chromatic-com/storybook'),
12+
getAbsolutePath('@storybook/addon-interactions'),
13+
getAbsolutePath('@storybook/addon-mdx-gfm'),
14+
getAbsolutePath('@storybook/addon-storysource'),
15+
],
16+
17+
framework: {
18+
name: getAbsolutePath('@storybook/nextjs'),
19+
options: {},
20+
},
21+
22+
webpackFinal: async (config) => {
23+
const updatedConfig = {
24+
...config,
25+
resolve: {
26+
...config.resolve,
27+
alias: {
28+
...config.resolve?.alias,
29+
common: path.resolve(__dirname, '../src/common.scss'),
30+
},
31+
},
32+
};
33+
34+
return updatedConfig;
35+
},
36+
37+
staticDirs: ['../public'],
38+
39+
docs: {},
40+
41+
typescript: {
42+
reactDocgen: 'react-docgen-typescript',
43+
},
44+
};
45+
export default config;
46+
47+
function getAbsolutePath(value: string): any {
48+
return dirname(require.resolve(join(value, 'package.json')));
49+
}

Diff for: .storybook/preview.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Preview } from '@storybook/react';
2+
import '../src/global.scss';
3+
4+
const preview: Preview = {
5+
parameters: {
6+
layout: 'centered',
7+
},
8+
tags: ['autodocs'],
9+
};
10+
11+
export default preview;

0 commit comments

Comments
 (0)