-
Notifications
You must be signed in to change notification settings - Fork 95
feat(storybook): upgrade from v6 to v10 #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b9159e7
upgrade from 6 to 8
lsagetlethias 4eddd8a
upgrade from 8 to 9
lsagetlethias 0a430b0
upgrade from 9 to 10
lsagetlethias f2be923
unstyled tweak and fix picto
lsagetlethias 851e9e4
fix story order
lsagetlethias 4c162f3
remove unused import
lsagetlethias 808e784
handle dsfr dark theme during sb loading
lsagetlethias 994e57d
feat: upgrade storybook and add ToC
lsagetlethias 2284f31
feat: toc as dsfr side menu
lsagetlethias 8ef98a5
Merge branch 'main' of github.com:codegouvfr/react-dsfr into feat/upg…
lsagetlethias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,4 @@ CHANGELOG.md | |
| .yarn_home/ | ||
| /test/integration/ | ||
| /storybook-static/ | ||
|
|
||
| !.storybook | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { StorybookConfig } from "@storybook/react-vite"; | ||
|
|
||
| export default { | ||
| framework: { | ||
| name: "@storybook/react-vite", | ||
| options: {} | ||
| }, | ||
| features: { | ||
| controls: true | ||
| }, | ||
|
lsagetlethias marked this conversation as resolved.
|
||
| stories: [ | ||
| "../stories/*.mdx", | ||
| "../stories/*.stories.@(ts|tsx)", | ||
| "../stories/blocks/*.stories.@(ts|tsx)", | ||
| "../stories/charts/*.stories.@(ts|tsx)", | ||
| "../stories/picto/*.stories.@(ts|tsx)" | ||
| ], | ||
| addons: [ | ||
| "@storybook/addon-links", | ||
|
lsagetlethias marked this conversation as resolved.
|
||
| "@vueless/storybook-dark-mode", | ||
| "@storybook/addon-a11y", | ||
| "@storybook/addon-docs" | ||
| ], | ||
| staticDirs: ["../dist", "./static"] | ||
| } satisfies StorybookConfig; | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| import { darkTheme, lightTheme } from "./customTheme"; | ||
| import { DocsContainer } from "./DocsContainer"; | ||
| import { Parameters, Preview } from "@storybook/react-vite"; | ||
|
|
||
| const preview: Preview = { | ||
| tags: ["autodocs"], | ||
| parameters: { | ||
| "actions": { "argTypesRegex": "^on[A-Z].*" }, | ||
| "controls": { | ||
| "matchers": { | ||
| "color": /(background|color)$/i, | ||
| "date": /Date$/ | ||
| } | ||
| }, | ||
| "backgrounds": { disable: true }, | ||
| "darkMode": { | ||
| "light": lightTheme, | ||
| "dark": darkTheme | ||
| }, | ||
| "docs": { | ||
| "container": DocsContainer | ||
| }, | ||
| "viewport": { | ||
| options: { | ||
| "1440p": { | ||
| "name": "1440p", | ||
| "styles": { | ||
| "width": "2560px", | ||
| "height": "1440px" | ||
| } | ||
| }, | ||
| "fullHD": { | ||
| "name": "Full HD", | ||
| "styles": { | ||
| "width": "1920px", | ||
| "height": "1080px" | ||
| } | ||
| }, | ||
| "macBookProBig": { | ||
| "name": "MacBook Pro Big", | ||
| "styles": { | ||
| "width": "1024px", | ||
| "height": "640px" | ||
| } | ||
| }, | ||
| "macBookProMedium": { | ||
| "name": "MacBook Pro Medium", | ||
| "styles": { | ||
| "width": "1440px", | ||
| "height": "900px" | ||
| } | ||
| }, | ||
| "macBookProSmall": { | ||
| "name": "MacBook Pro Small", | ||
| "styles": { | ||
| "width": "1680px", | ||
| "height": "1050px" | ||
| } | ||
| }, | ||
| "pcAgent": { | ||
| "name": "PC Agent", | ||
| "styles": { | ||
| "width": "960px", | ||
| "height": "540px" | ||
| } | ||
| }, | ||
| "iphone12Pro": { | ||
| "name": "Iphone 12 pro", | ||
| "styles": { | ||
| "width": "390px", | ||
| "height": "844px" | ||
| } | ||
| }, | ||
| "iphone5se": { | ||
| "name": "Iphone 5/SE", | ||
| "styles": { | ||
| "width": "320px", | ||
| "height": "568px" | ||
| } | ||
| }, | ||
| "ipadPro": { | ||
| "name": "Ipad pro", | ||
| "styles": { | ||
| "width": "1240px", | ||
| "height": "1366px" | ||
| } | ||
| }, | ||
| "Galaxy s9+": { | ||
| "name": "Galaxy S9+", | ||
| "styles": { | ||
| "width": "320px", | ||
| "height": "658px" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
|
lsagetlethias marked this conversation as resolved.
Outdated
|
||
| "options": { | ||
| "storySort": (a: any, b: any) => | ||
| getHardCodedWeight(b[1].kind) - getHardCodedWeight(a[1].kind) | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| export default preview; | ||
|
|
||
| const { getHardCodedWeight } = (() => { | ||
| const orderedPagesPrefix = [ | ||
| "🇫🇷 Introduction", | ||
| //"components", | ||
| "components/Header", | ||
| "components/Footer", | ||
| "components/consentManagement", | ||
| "components/Alert", | ||
| "components/Tabs", | ||
| "components/Stepper", | ||
| "components/Button", | ||
| "components/FranceConnectButton", | ||
| "components/ProConnectButton" | ||
| ]; | ||
|
|
||
| function getHardCodedWeight(kind: string) { | ||
| for (let i = 0; i < orderedPagesPrefix.length; i++) { | ||
| if (kind.toLowerCase().startsWith(orderedPagesPrefix[i].toLowerCase())) { | ||
| return orderedPagesPrefix.length - i; | ||
| } | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| return { getHardCodedWeight }; | ||
| })(); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.