-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FOROME-969): Added storybook and few stories (#611)
- Loading branch information
1 parent
2594e71
commit 0e5fe7f
Showing
10 changed files
with
6,398 additions
and
153 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,32 @@ | ||
const path = require('path') | ||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin') | ||
|
||
module.exports = { | ||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-interactions', | ||
'@storybook/preset-create-react-app', | ||
'storybook-dark-mode', | ||
], | ||
framework: '@storybook/react', | ||
core: { | ||
builder: '@storybook/builder-webpack5', | ||
}, | ||
webpackFinal: async (config, { configType }) => { | ||
config.module.rules.push({ | ||
test: /\.scss|.sass$/, | ||
use: ['style-loader', 'css-loader', 'sass-loader'], | ||
include: path.resolve(__dirname, '../'), | ||
}) | ||
|
||
config.resolve.plugins = [ | ||
new TsconfigPathsPlugin({ | ||
configFile: path.resolve(__dirname, '../tsconfig.json'), | ||
}), | ||
] | ||
|
||
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,11 @@ | ||
import '../src/index.css' | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
} |
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,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
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 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,11 @@ | ||
import { Button } from '@ui/button' | ||
import { ComponentMeta, ComponentStory } from '@storybook/react' | ||
|
||
export default { | ||
title: 'Button', | ||
component: Button, | ||
} as ComponentMeta<typeof Button> | ||
|
||
export const Template: ComponentStory<typeof Button> = args => ( | ||
<Button variant="primary" text="Button" {...args} /> | ||
) |
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,38 @@ | ||
import { PopperMenu } from '@components/popper-menu/popper-menu' | ||
import { PopperMenuItem } from '@components/popper-menu/popper-menu-item' | ||
import { ComponentMeta, ComponentStory } from '@storybook/react' | ||
|
||
export default { | ||
title: 'Popper Menu', | ||
component: PopperMenu, | ||
} as ComponentMeta<typeof PopperMenu> | ||
|
||
const Template: ComponentStory<typeof PopperMenu> = args => ( | ||
<div style={{ width: '100px' }}> | ||
<PopperMenu {...args} close={() => {}}> | ||
{args.children} | ||
</PopperMenu> | ||
</div> | ||
) | ||
|
||
export const Default = Template.bind({}) | ||
|
||
Default.args = { | ||
children: ( | ||
<> | ||
<PopperMenuItem>Item 1</PopperMenuItem> | ||
<PopperMenuItem>Item 2</PopperMenuItem> | ||
</> | ||
), | ||
} | ||
|
||
export const WithIcon = Template.bind({}) | ||
|
||
WithIcon.args = { | ||
children: ( | ||
<> | ||
<PopperMenuItem iconName="Cloud">Item 1</PopperMenuItem> | ||
<PopperMenuItem iconName="Copy">Item 2</PopperMenuItem> | ||
</> | ||
), | ||
} |
Oops, something went wrong.