-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add support for css to storybook (#4950)
* docs: add support for css to storybook * chore: remove commented code * chore: add explicit dependency used by storybook tool * chore: add dependency used by internal addon * refactor: update internal storybook dependencies * chore(deps): update deps version * chore: run npm dedupe * chore: update stories * chore: try out different loader techniques * refactor(storybook): update from @storybook/react-webpack5 to @storybook/react-vite * chore: update settings to match rollup build output * chore: remove top-level postcss config --------- Co-authored-by: Josh Black <joshblack@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
3,870 additions
and
14,197 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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,59 @@ | ||
import {createRequire} from 'node:module' | ||
import path from 'node:path' | ||
import postcssPresetPrimer from 'postcss-preset-primer' | ||
import type {StorybookConfig} from '@storybook/react-vite' | ||
|
||
const require = createRequire(import.meta.url) | ||
|
||
const {DEPLOY_ENV = 'development'} = process.env | ||
|
||
const config: StorybookConfig = { | ||
stories: | ||
DEPLOY_ENV === 'development' | ||
? ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'] | ||
: // Don't include dev stories in production | ||
['../src/**/*.mdx', '../src/**/!(*.dev).stories.@(js|jsx|ts|tsx)'], | ||
addons: [ | ||
{ | ||
name: '@storybook/addon-essentials', | ||
options: { | ||
backgrounds: false, | ||
}, | ||
}, | ||
getAbsolutePath('@storybook/addon-storysource'), | ||
getAbsolutePath('@storybook/addon-interactions'), | ||
getAbsolutePath('@storybook/addon-a11y'), | ||
getAbsolutePath('@storybook/addon-links'), | ||
], | ||
|
||
framework: { | ||
name: '@storybook/react-vite', | ||
options: {}, | ||
}, | ||
async viteFinal(config) { | ||
config.define = { | ||
...config.define, | ||
__DEV__: JSON.stringify(true), | ||
} | ||
|
||
config.css = { | ||
...config.css, | ||
modules: { | ||
...config.css?.modules, | ||
generateScopedName: 'prc_[local]_[hash:base64:5]', | ||
}, | ||
postcss: { | ||
...config.css?.postcss, | ||
plugins: [postcssPresetPrimer()], | ||
}, | ||
} | ||
|
||
return config | ||
}, | ||
} | ||
|
||
export default config | ||
|
||
function getAbsolutePath(value) { | ||
return path.dirname(require.resolve(path.join(value, 'package.json'))) | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/react/.storybook/manager.js → packages/react/.storybook/manager.jsx
This file contains 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
2 changes: 1 addition & 1 deletion
2
packages/react/.storybook/preview.js → packages/react/.storybook/preview.jsx
This file contains 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 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 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.
3 changes: 1 addition & 2 deletions
3
packages/react/src/drafts/MarkdownEditor/MarkdownEditor.features.stories.tsx
This file contains 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
3 changes: 1 addition & 2 deletions
3
packages/react/src/drafts/MarkdownEditor/MarkdownEditor.stories.tsx
This file contains 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
3 changes: 1 addition & 2 deletions
3
packages/react/src/drafts/MarkdownViewer/MarkdownViewer.features.stories.tsx
This file contains 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
3 changes: 1 addition & 2 deletions
3
packages/react/src/drafts/MarkdownViewer/MarkdownViewer.stories.tsx
This file contains 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 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