Skip to content

Commit c592a41

Browse files
committed
docs: 📝 upgrade storybook & améliorations doc
- mise à jour vers storybook 7.5.3 - ajoute les styles du DSFR pour toutes les docs mdx - ajoute une page pour prévisualiser toutes les couleurs du DSFR
1 parent f856622 commit c592a41

File tree

16 files changed

+12952
-18915
lines changed

16 files changed

+12952
-18915
lines changed

.storybook/main.js

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

.storybook/main.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import type { StorybookConfig } from "@storybook/vue3-vite";
2+
3+
const config: StorybookConfig = {
4+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5+
addons: [
6+
"@storybook/addon-links",
7+
"@storybook/addon-essentials",
8+
"@storybook/addon-interactions",
9+
"@storybook/addon-themes",
10+
"@storybook/addon-styling",
11+
{
12+
name: '@storybook/addon-postcss',
13+
options: {
14+
postcssLoaderOptions: {
15+
implementation: require('postcss'),
16+
}
17+
}
18+
},
19+
],
20+
staticsDir: ['../public'],
21+
framework: {
22+
name: "@storybook/vue3-vite",
23+
options: {},
24+
},
25+
docs: {
26+
autodocs: true,
27+
},
28+
};
29+
export default config;

.storybook/manager.js

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

.storybook/manager.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { addons } from '@storybook/manager-api'
2+
import { themes } from '@storybook/theming'
3+
import VueDsfrTheme from './vue-dsfr-theme.js'
4+
5+
addons.setConfig({
6+
theme: { ...themes.normal, ...VueDsfrTheme },
7+
})

.storybook/preview-head.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<script>
2-
// Fix: add `jest` to global
32
window.global = window
43
</script>

.storybook/preview.js

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

.storybook/preview.ts

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import type { Preview } from "@storybook/vue3"
2+
import { themes } from '@storybook/theming'
3+
import { withThemeByDataAttribute } from "@storybook/addon-themes"
4+
5+
import { FocusTrap } from 'focus-trap-vue'
6+
import { defineComponent } from 'vue'
7+
8+
import VueDsfrTheme from './vue-dsfr-theme.js'
9+
import {OhVueIcon as VIcon} from 'oh-vue-icons'
10+
11+
import '../src/assets/variables-fdr.css'
12+
import '@gouvfr/dsfr/dist/dsfr.min.css'
13+
import '@gouvfr/dsfr/dist/utility/utility.main.min.css'
14+
import '@gouvfr/dsfr/dist/utility/icons/icons.main.min.css'
15+
16+
import '../src/main.css'
17+
18+
import './theme.css'
19+
20+
export const decorators = [
21+
withThemeByDataAttribute({
22+
themes: {
23+
Clair: 'light',
24+
Sombre: 'dark',
25+
},
26+
defaultTheme: 'light',
27+
attributeName: 'data-fr-theme',
28+
})
29+
]
30+
31+
const preview: Preview = {
32+
parameters: {
33+
docs: {
34+
theme: { ...themes.normal, ...VueDsfrTheme },
35+
},
36+
actions: { argTypesRegex: "^on[A-Z].*" },
37+
controls: {
38+
matchers: {
39+
color: /(background|color)$/i,
40+
date: /Date$/i,
41+
},
42+
},
43+
viewport: {
44+
viewports: {
45+
DSFR_XS: {
46+
name: 'DSFR XS',
47+
styles: {
48+
width: '320px',
49+
height: '768px',
50+
},
51+
},
52+
DSFR_SM: {
53+
name: 'DSFR SM',
54+
styles: {
55+
width: '576px',
56+
height: '1024px',
57+
},
58+
},
59+
DSFR_MD: {
60+
name: 'DSFR MD',
61+
styles: {
62+
width: '768px',
63+
height: '1200px',
64+
},
65+
},
66+
DSFR_LG: {
67+
name: 'DSFR LG',
68+
styles: {
69+
width: '992px',
70+
height: '1600px',
71+
},
72+
},
73+
DSFR_XL: {
74+
name: 'DSFR XL',
75+
styles: {
76+
width: '1440px',
77+
height: '1900px',
78+
},
79+
},
80+
}
81+
},
82+
options: {
83+
storySort: {
84+
method: 'alphabetical',
85+
order: [
86+
'Docs',
87+
'Fondamentaux',
88+
'Composables',
89+
'Composants',
90+
],
91+
},
92+
}
93+
},
94+
}
95+
96+
export default preview;

0 commit comments

Comments
 (0)