-
Notifications
You must be signed in to change notification settings - Fork 0
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 #28 from academic-relations/27-setup-storybook
Setup storybook
- Loading branch information
Showing
9 changed files
with
4,489 additions
and
158 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 |
---|---|---|
|
@@ -34,3 +34,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,22 @@ | ||
import type { StorybookConfig } from "@storybook/nextjs"; | ||
|
||
const config: StorybookConfig = { | ||
stories: [ | ||
"../stories/**/*.stories.@(js|jsx|ts|tsx)", | ||
"../stories/*.stories.@(js|jsx|ts|tsx)", | ||
], | ||
addons: [ | ||
"@storybook/addon-onboarding", | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@chromatic-com/storybook", | ||
"@storybook/addon-interactions", | ||
"@storybook/addon-themes", | ||
], | ||
framework: { | ||
name: "@storybook/nextjs", | ||
options: {}, | ||
}, | ||
staticDirs: ["../public"], | ||
}; | ||
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,10 @@ | ||
<link | ||
rel="stylesheet" | ||
href="https://fonts.googleapis.com/icon?family=Material+Icons" | ||
/> | ||
|
||
<style> | ||
a { | ||
text-decoration: none; | ||
} | ||
</style> |
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,46 @@ | ||
import react from "React"; | ||
|
||
import type { Preview } from "@storybook/react"; | ||
|
||
import { ThemeProvider } from "styled-components"; | ||
import { withThemeFromJSXProvider } from "@storybook/addon-themes"; | ||
|
||
import colors from "../src/styles/themes/colors"; | ||
import fonts from "../src/styles/themes/fonts"; | ||
import responsive from "../src/styles/themes/responsive"; | ||
import round from "../src/styles/themes/round"; | ||
import shadow from "../src/styles/themes/shadow"; | ||
import sizes from "../src/styles/themes/sizes"; | ||
import zIndices from "../src/styles/themes/zIndices"; | ||
|
||
const Theme = { | ||
colors, | ||
fonts, | ||
responsive, | ||
round, | ||
shadow, | ||
sizes, | ||
zIndices, | ||
}; | ||
|
||
// import fonts from '@sparcs-students/web/common/components/styles/themes.d.ts' | ||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
decorators: [ | ||
withThemeFromJSXProvider({ | ||
themes: { | ||
Theme, | ||
}, | ||
Provider: ThemeProvider, | ||
}), | ||
], | ||
}; | ||
|
||
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,33 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import BreadCrumb from "@sparcs-students/web/common/components/BreadCrumb/index"; | ||
|
||
const meta: Meta<typeof BreadCrumb> = { | ||
title: "components/BreadCrumb", | ||
component: BreadCrumb, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
|
||
argTypes: { | ||
items: { | ||
control: { type: "object" }, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const example: Story = { | ||
args: { | ||
items: [ | ||
{ | ||
name: "동아리 목록", | ||
path: "/clubs", | ||
}, | ||
], | ||
enableLast: false, | ||
}, | ||
}; |
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,44 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import React from "react"; | ||
|
||
import { fn } from "@storybook/test"; | ||
|
||
import Button from "@sparcs-students/web/common/components/Buttons/Button"; | ||
import Tag from "@sparcs-students/web/common/components/Tag"; | ||
|
||
const meta: Meta<typeof Button> = { | ||
title: "components/Buttons/Button", | ||
component: Button, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
argTypes: { | ||
type: { | ||
control: { type: "select", options: ["default", "outlined", "disabled"] }, | ||
defaultValue: "default", | ||
}, | ||
buttonText: { | ||
control: "text", | ||
}, | ||
iconType: { | ||
control: "text", | ||
}, | ||
children: { | ||
control: false, | ||
}, | ||
}, | ||
args: { onClick: fn() }, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const example: Story = { | ||
args: { | ||
type: "default", | ||
buttonText: "Button", | ||
children: <Tag color="GREEN">Example Tag Children</Tag>, | ||
iconType: "person", | ||
}, | ||
}; |
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,30 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { fn } from "@storybook/test"; | ||
|
||
import TextButton from "@sparcs-students/web/common/components/Buttons/TextButton"; | ||
|
||
const meta: Meta<typeof TextButton> = { | ||
title: "components/Buttons/TextButton", | ||
component: TextButton, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
|
||
argTypes: { | ||
text: { | ||
control: "text", | ||
}, | ||
}, | ||
args: { onClick: fn() }, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const example: Story = { | ||
args: { | ||
text: "Button", | ||
}, | ||
}; |
Oops, something went wrong.