-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
7,643 additions
and
115 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,52 @@ | ||
// .storybook/main.js | ||
|
||
const path = require('path'); | ||
|
||
module.exports = { | ||
stories: [ | ||
'../components/*.stories.mdx', | ||
'../components/*.stories.@(js|jsx|ts|tsx)', | ||
], | ||
/** Expose public folder to storybook as static */ | ||
staticDirs: ['../public'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
{ | ||
/** | ||
* Fix Storybook issue with PostCSS@8 | ||
* @see https://github.com/storybookjs/storybook/issues/12668#issuecomment-773958085 | ||
*/ | ||
name: '@storybook/addon-postcss', | ||
options: { | ||
postcssLoaderOptions: { | ||
implementation: require('postcss'), | ||
}, | ||
}, | ||
}, | ||
], | ||
core: { | ||
builder: 'webpack5', | ||
}, | ||
webpackFinal: (config) => { | ||
/** | ||
* Add support for alias-imports | ||
* @see https://github.com/storybookjs/storybook/issues/11989#issuecomment-715524391 | ||
*/ | ||
config.resolve.alias = { | ||
...config.resolve?.alias, | ||
'@': [path.resolve(__dirname, '../components/'), path.resolve(__dirname, '../')], | ||
}; | ||
|
||
/** | ||
* Fixes font import with / | ||
* @see https://github.com/storybookjs/storybook/issues/12844#issuecomment-867544160 | ||
*/ | ||
config.resolve.roots = [ | ||
path.resolve(__dirname, '../public'), | ||
'node_modules', | ||
]; | ||
|
||
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,22 @@ | ||
import '../styles/globals.css'; | ||
import * as NextImage from 'next/image'; | ||
|
||
const OriginalNextImage = NextImage.default; | ||
|
||
Object.defineProperty(NextImage, 'default', { | ||
configurable: true, | ||
value: (props) => <OriginalNextImage {...props} unoptimized />, | ||
}); | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
previewTabs: { | ||
'storybook/docs/panel': { index: -1 }, | ||
}, | ||
}; |
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 @@ | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import * as React from 'react'; | ||
import { HiSearch } from 'react-icons/hi'; | ||
|
||
import { Button } from './Button'; | ||
|
||
export default { | ||
title: 'Components/Button', | ||
component: Button, | ||
argTypes: { | ||
children: { | ||
control: { type: 'text' }, | ||
}, | ||
}, | ||
} as ComponentMeta<typeof Button>; | ||
|
||
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
children: 'Button', | ||
}; | ||
|
||
export const WithIcon = Template.bind({}); | ||
WithIcon.args = { | ||
children: ( | ||
<div className='flex gap-2 items-center'> | ||
<HiSearch /> | ||
<span>Search</span> | ||
</div> | ||
), | ||
}; |
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.
960d44e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: