-
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.
feat: add example with basic usage of storybook
- Loading branch information
Showing
6 changed files
with
2,716 additions
and
2,555 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
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 |
---|---|---|
@@ -1,29 +1,18 @@ | ||
import type { StorybookConfig } from '@storybook/nextjs'; | ||
|
||
import { join, dirname } from 'path'; | ||
|
||
function getAbsolutePath(value: string): any { | ||
return dirname(require.resolve(join(value, 'package.json'))); | ||
} | ||
const config: StorybookConfig = { | ||
core: { | ||
builder: '@storybook/builder-webpack5', | ||
}, | ||
stories: ['../src/components/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: [ | ||
getAbsolutePath('@storybook/addon-links'), | ||
getAbsolutePath('@storybook/addon-essentials'), | ||
getAbsolutePath('@storybook/addon-onboarding'), | ||
getAbsolutePath('@storybook/addon-interactions'), | ||
getAbsolutePath('@storybook/addon-styling-webpack'), | ||
getAbsolutePath('storybook-dark-mode'), | ||
framework: '@storybook/nextjs', | ||
addons: ['@storybook/addon-controls', '@storybook/addon-styling-webpack', 'storybook-dark-mode'], | ||
stories: [ | ||
{ | ||
directory: '../src/components', | ||
titlePrefix: 'Application components', | ||
}, | ||
{ | ||
directory: '../src/theme/components', | ||
titlePrefix: 'UI Kit', | ||
}, | ||
], | ||
framework: { | ||
name: getAbsolutePath('@storybook/nextjs'), | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
}; | ||
|
||
export default 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
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
31 changes: 31 additions & 0 deletions
31
template/apps/web/src/theme/components/Button/index.stories.tsx
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,31 @@ | ||
import { Button, ButtonProps } from '@mantine/core'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta = { | ||
component: Button, | ||
args: { | ||
children: 'Button', | ||
variant: 'primary', | ||
size: 'md', | ||
loading: false, | ||
}, | ||
argTypes: { | ||
variant: { | ||
options: ['primary', 'outline'], | ||
control: { type: 'radio' }, | ||
}, | ||
size: { | ||
options: ['md', 'lg'], | ||
control: { type: 'radio' }, | ||
}, | ||
loading: { | ||
control: { type: 'boolean' }, | ||
}, | ||
}, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<ButtonProps>; | ||
|
||
export const Basic: Story = {}; |
Oops, something went wrong.