-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from airswap/storybook
Storybook
- Loading branch information
Showing
6 changed files
with
6,414 additions
and
3,400 deletions.
There are no files selected for viewing
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,39 @@ | ||
const path = require("path"); | ||
module.exports = { | ||
// ref: https://storybook.js.org/docs/ember/configure/typescript#mainjs-configuration | ||
typescript: { | ||
check: false, | ||
checkOptions: {}, | ||
reactDocgen: "react-docgen-typescript", | ||
reactDocgenTypescriptOptions: { | ||
shouldExtractLiteralValuesFromEnum: true, | ||
propFilter: (prop) => | ||
prop.parent ? !/node_modules/.test(prop.parent.fileName) : true, | ||
}, | ||
}, | ||
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@storybook/preset-create-react-app", | ||
"storybook-tailwind-dark-mode", | ||
], | ||
|
||
// Tell webpack to apply tailwind to postcss loader | ||
webpackFinal: async (config) => { | ||
config.module.rules.push({ | ||
test: /\.css$/, | ||
use: [ | ||
{ | ||
loader: "postcss-loader", | ||
options: { | ||
ident: "postcss", | ||
plugins: [require("tailwindcss"), require("autoprefixer")], | ||
}, | ||
}, | ||
], | ||
include: path.resolve(__dirname, "../"), | ||
}); | ||
return config; | ||
}, | ||
}; |
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,12 @@ | ||
import "../src/index.css"; | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
viewMode: "docs", | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Story, Meta } from "@storybook/react"; | ||
|
||
import { Button, ButtonProps } from "./Button"; | ||
|
||
export default { | ||
title: "components/Button", | ||
component: Button, | ||
argTypes: { | ||
disabled: { control: { type: "boolean" } }, | ||
loading: { control: { type: "boolean" } }, | ||
className: { control: { type: "text" } }, | ||
}, | ||
} as Meta; | ||
|
||
const Template: Story<ButtonProps> = (args) => <Button {...args} />; | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
children: "Click me", | ||
intent: "primary", | ||
}; | ||
|
||
export const Loading = Template.bind({}); | ||
Loading.args = { | ||
...Primary.args, | ||
loading: true, | ||
}; | ||
|
||
export const Disabled = Template.bind({}); | ||
Disabled.args = { | ||
...Primary.args, | ||
disabled: true, | ||
}; |
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
Oops, something went wrong.