-
Notifications
You must be signed in to change notification settings - Fork 2
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 #10 from danilo-89/storybook
Storybook
- Loading branch information
Showing
7 changed files
with
7,635 additions
and
1,157 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
"extends": [ | ||
"next/core-web-vitals", | ||
"plugin:storybook/recommended" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -33,3 +33,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
*storybook.log |
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,35 @@ | ||
import type { StorybookConfig } from '@storybook/nextjs' | ||
import path from 'path' | ||
|
||
const config: StorybookConfig = { | ||
stories: [ | ||
'../stories/**/*.mdx', | ||
'../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)', | ||
], | ||
addons: [ | ||
'@storybook/addon-onboarding', | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@chromatic-com/storybook', | ||
'@storybook/addon-interactions', | ||
], | ||
framework: { | ||
name: '@storybook/nextjs', | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
staticDirs: ['../public'], | ||
webpackFinal: async (config: any) => ({ | ||
...config, | ||
resolve: { | ||
...config.resolve, | ||
alias: { | ||
...config.resolve.alias, | ||
'@': path.resolve(__dirname, '../'), | ||
}, | ||
}, | ||
}), | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react' | ||
import type { Preview } from '@storybook/react' | ||
import { Poppins, Yellowtail } from 'next/font/google' | ||
|
||
const poppins = Poppins({ | ||
subsets: ['latin'], | ||
weight: ['400', '700'], | ||
variable: '--font-poppins', | ||
}) | ||
const yellowtail = Yellowtail({ | ||
subsets: ['latin'], | ||
weight: ['400'], | ||
variable: '--font-yellowtail', | ||
}) | ||
|
||
import '../app/globals.css' | ||
|
||
const preview: Preview = { | ||
decorators: [ | ||
(Story) => ( | ||
<main | ||
className={`${poppins.variable} ${yellowtail.variable} bg-champagne text-wenge`} | ||
> | ||
<Story /> | ||
</main> | ||
), | ||
], | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
export default preview |
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,65 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import Button from '../components/common/Button' | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export | ||
const meta = { | ||
title: 'Button', | ||
component: Button, | ||
parameters: { | ||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout | ||
layout: 'centered', | ||
}, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
// More on argTypes: https://storybook.js.org/docs/api/argtypes | ||
argTypes: {}, | ||
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args | ||
args: { children: 'Lorem Ipsum' }, | ||
} satisfies Meta<typeof Button> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args | ||
|
||
// Variations | ||
|
||
export const Primary: Story = {} | ||
|
||
export const Secondary: Story = { | ||
args: { | ||
variation: 'secondary', | ||
}, | ||
} | ||
|
||
export const Neutral: Story = { | ||
args: { | ||
variation: 'neutral', | ||
}, | ||
} | ||
|
||
export const Transparent: Story = { | ||
args: { | ||
variation: 'transparent', | ||
}, | ||
} | ||
|
||
// Sizes | ||
|
||
export const Small: Story = { | ||
args: { | ||
size: 'sm', | ||
}, | ||
} | ||
|
||
export const Medium: Story = { | ||
args: { | ||
size: 'md', | ||
}, | ||
} | ||
|
||
export const Large: Story = { | ||
args: { | ||
size: 'lg', | ||
}, | ||
} |
Oops, something went wrong.