Skip to content

Commit

Permalink
Storybook 7 (#972)
Browse files Browse the repository at this point in the history
* feat: storybook 7 and configuration updates

Closes D2IQ-92603

* docs: updated stories from csf2 to csf3
  • Loading branch information
nataliepina authored Jun 5, 2023
1 parent 97cb6b0 commit e10af7c
Show file tree
Hide file tree
Showing 88 changed files with 27,680 additions and 49,682 deletions.
Binary file removed .storybook/docs/assets/favicon.ico
Binary file not shown.
10 changes: 6 additions & 4 deletions .storybook/docs/stories/Typography.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/addon-docs";
import { Meta, Unstyled } from "@storybook/addon-docs";
import { Typeset } from "@storybook/addon-docs";
import {
fontFamilySansSerif,
Expand Down Expand Up @@ -42,7 +42,9 @@ import {
sampleText="The quick brown fox jumps over the lazy dog"
/>
<h2>Heading Text</h2>
<HeadingText1>Heading Text 1</HeadingText1>
<HeadingText2>Heading Text 2</HeadingText2>
<HeadingText3>Heading Text 3</HeadingText3>
<Unstyled>
<HeadingText1>Heading Text 1</HeadingText1>
<HeadingText2>Heading Text 2</HeadingText2>
<HeadingText3>Heading Text 3</HeadingText3>
</Unstyled>
</div>
10 changes: 6 additions & 4 deletions .storybook/docs/stories/Welcome.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/addon-docs";
import { Meta, Unstyled } from "@storybook/addon-docs";

import { WelcomeBanner, WelcomeCards, WelcomeFooter } from "../index.ts";

Expand All @@ -11,6 +11,8 @@ import { WelcomeBanner, WelcomeCards, WelcomeFooter } from "../index.ts";
}}
/>

<WelcomeBanner />
<WelcomeCards />
<WelcomeFooter />
<Unstyled>
<WelcomeBanner />
<WelcomeCards />
<WelcomeFooter />
</Unstyled>
17 changes: 12 additions & 5 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
const customWebpack = require("./webpack.config");

module.exports = {
core: {
builder: "webpack5"
},
stories: [
"./docs/stories/Welcome.stories.mdx",
"./docs/stories/Colors.stories.mdx",
"./docs/stories/Typography.stories.mdx",
"../packages/**/*.stories.@(tsx|mdx)"
],
webpackFinal: config => {
return { ...config, ...customWebpack };
return {
...config,
...customWebpack
};
},
addons: [
{
Expand All @@ -24,5 +23,13 @@ module.exports = {
],
features: {
previewMdx2: true
},
framework: {
name: "@storybook/react-webpack5",
options: {}
},
staticDirs: ["../public/assets/images"],
docs: {
autodocs: true
}
};
1 change: 1 addition & 0 deletions .storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
3 changes: 0 additions & 3 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { addons } from "@storybook/addons";
import Theme from "./theme";
import favicon from "./docs/assets/favicon.ico";

const link = document.createElement("link");
link.setAttribute("rel", "shortcut icon");
link.setAttribute("href", favicon);
document.head.appendChild(link);

addons.setConfig({
Expand Down
2 changes: 1 addition & 1 deletion .storybook/theme.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { create } from "@storybook/theming";
import { create } from "@storybook/theming/create";
import logo from "./static/logo.png";

export default create({
Expand Down
3 changes: 0 additions & 3 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ module.exports = ({ config }) => {
config.resolve.extensions = config.resolve.extensions.concat(
webpackBase.getExtensions()
);
config.resolve.alias["core-js"] = path.dirname(require.resolve("core-js"));
config.module.rules[0].use[0].options.sourceType = "unambiguous";

// Storybook has loaders configured that conflict with what you define in our custom Webpack configuration,
// so if you do not override those then your custom rules will not work.
// Remove the rule that loads SVGs as assets for storybook
Expand Down
Loading

0 comments on commit e10af7c

Please sign in to comment.