Skip to content

Commit

Permalink
chore: 🤖 let Storybook read SCSS
Browse files Browse the repository at this point in the history
  • Loading branch information
ginpei authored Jul 14, 2021
1 parent 46f126b commit 23938e8
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
const path = require('path');

module.exports = {
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.

// Make whatever fine-grained changes you need
config.module.rules.push({
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: path.resolve(__dirname, '../'),
});

// Return the altered config
return config;
},
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
Expand Down
2 changes: 2 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "../src/gp/styles/index.scss";

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
Expand Down
52 changes: 52 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"git-cz": "^4.7.6",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"sass-loader": "^10.2.0",
"ts-jest": "^27.0.3",
"typescript": "4.3.5"
}
Expand Down
16 changes: 16 additions & 0 deletions src/ui/form/NiceButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ComponentMeta, ComponentStory } from "@storybook/react";
import { NiceButton } from "./NiceButton";

export default {
title: "Nice/NiceButton",
component: NiceButton,
} as ComponentMeta<typeof NiceButton>;

const Template: ComponentStory<typeof NiceButton> = (args) => (
<NiceButton {...args} />
);

export const Primary = Template.bind({});
Primary.args = {
children: "Button",
};

0 comments on commit 23938e8

Please sign in to comment.