-
Notifications
You must be signed in to change notification settings - Fork 0
feat: mds 2.0 스토리북 설정 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f15f9d1
chore: configs/tsconfig package
wuzoo dd61c5b
feat: @design-tokens, @ui sample code
wuzoo fad8dc2
feat: storybook setting
wuzoo 01ba2a8
feat: add component scaffolding script
wuzoo 00204c3
chore: install required deps
wuzoo 9613210
docs: ci check & storybook deploy
wuzoo 35d44a5
chore: add suit load script
wuzoo 8f30783
refactor: template 수정
wuzoo f347bce
feat: storybook preview to chromatic
wuzoo 502d282
docs: add comment storybook url
wuzoo 5cde83a
chore: button introduction 추가
wuzoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or 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,18 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig", | ||
| "compilerOptions": { | ||
| "target": "ES2022", | ||
| "lib": ["ES2022"], | ||
| "module": "ESNext", | ||
| "moduleResolution": "Bundler", | ||
| "esModuleInterop": true, | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "verbatimModuleSyntax": true, | ||
| "skipLibCheck": true, | ||
| "strict": true, | ||
| "noUncheckedIndexedAccess": true, | ||
| "noImplicitOverride": true, | ||
| "forceConsistentCasingInFileNames": true | ||
| } | ||
| } |
This file contains hidden or 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,8 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig", | ||
| "extends": "./base.json", | ||
| "compilerOptions": { | ||
| "lib": ["ES2022", "DOM", "DOM.Iterable"], | ||
| "jsx": "react-jsx" | ||
| } | ||
| } |
This file contains hidden or 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,5 +1,6 @@ | ||
| { | ||
| "name": "@makers/tsconfig", | ||
| "version": "0.0.0", | ||
| "private": true | ||
| "private": true, | ||
| "files": ["base.json", "library.json"] | ||
| } |
This file contains hidden or 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
Empty file.
This file contains hidden or 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,49 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
| import { baseColor } from "./color"; | ||
|
|
||
| interface SwatchProps { | ||
| name: string; | ||
| value: string; | ||
| } | ||
|
|
||
| function Swatch({ name, value }: SwatchProps) { | ||
| return ( | ||
| <div style={{ display: "flex", alignItems: "center", gap: 12, padding: 8 }}> | ||
| <div | ||
| style={{ | ||
| width: 48, | ||
| height: 48, | ||
| borderRadius: 8, | ||
| background: value, | ||
| border: "1px solid #e5e8eb", | ||
| }} | ||
| /> | ||
| <div> | ||
| <div style={{ fontWeight: 600 }}>{name}</div> | ||
| <div style={{ fontFamily: "monospace", color: "#6b7684" }}>{value}</div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function ColorGrid() { | ||
| return ( | ||
| <div | ||
| style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 8 }} | ||
| > | ||
| {Object.entries(baseColor).map(([name, value]) => ( | ||
| <Swatch key={name} name={name} value={value} /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| const meta: Meta<typeof ColorGrid> = { | ||
| title: "Base/Color", | ||
| component: ColorGrid, | ||
| parameters: { layout: "padded" }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| export const Palette: StoryObj<typeof ColorGrid> = {}; |
This file contains hidden or 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,21 @@ | ||
| export const baseColor = { | ||
| white: "#ffffff", | ||
| black: "#000000", | ||
| gray50: "#f9fafb", | ||
| gray100: "#f2f4f6", | ||
| gray200: "#e5e8eb", | ||
| gray300: "#d1d6db", | ||
| gray400: "#b0b8c1", | ||
| gray500: "#8b95a1", | ||
| gray600: "#6b7684", | ||
| gray700: "#4e5968", | ||
| gray800: "#333d4b", | ||
| gray900: "#191f28", | ||
| blue500: "#3182f6", | ||
| blue600: "#2272eb", | ||
| red500: "#f04452", | ||
| green500: "#00c896", | ||
| yellow500: "#f5a623", | ||
| } as const; | ||
|
|
||
| export type BaseColor = keyof typeof baseColor; |
This file contains hidden or 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,3 @@ | ||
| export * from "./color"; | ||
| export * from "./space"; | ||
| export * from "./typography"; |
This file contains hidden or 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,29 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
| import { space } from "./space"; | ||
|
|
||
| function SpaceScale() { | ||
| return ( | ||
| <div style={{ display: "flex", flexDirection: "column", gap: 8 }}> | ||
| {Object.entries(space).map(([token, value]) => ( | ||
| <div | ||
| key={token} | ||
| style={{ display: "flex", alignItems: "center", gap: 12 }} | ||
| > | ||
| <div style={{ width: 48, fontFamily: "monospace" }}>{token}</div> | ||
| <div style={{ background: "#3182f6", height: 16, width: value }} /> | ||
| <div style={{ color: "#6b7684" }}>{value}</div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| const meta: Meta<typeof SpaceScale> = { | ||
| title: "Base/Space", | ||
| component: SpaceScale, | ||
| parameters: { layout: "padded" }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| export const Scale: StoryObj<typeof SpaceScale> = {}; |
This file contains hidden or 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,15 @@ | ||
| export const space = { | ||
| "0": "0px", | ||
| "1": "2px", | ||
| "2": "4px", | ||
| "3": "8px", | ||
| "4": "12px", | ||
| "5": "16px", | ||
| "6": "20px", | ||
| "7": "24px", | ||
| "8": "32px", | ||
| "9": "40px", | ||
| "10": "48px", | ||
| } as const; | ||
|
|
||
| export type Space = keyof typeof space; |
This file contains hidden or 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,27 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
| import { typography } from "./typography"; | ||
|
|
||
| function TypographyScale() { | ||
| return ( | ||
| <div style={{ display: "flex", flexDirection: "column", gap: 16 }}> | ||
| {Object.entries(typography).map(([name, style]) => ( | ||
| <div key={name}> | ||
| <div style={{ color: "#6b7684", fontSize: 12, marginBottom: 4 }}> | ||
| {name} — {style.fontSize} / {style.lineHeight} / {style.fontWeight} | ||
| </div> | ||
| <div style={style}>다람쥐 헌 쳇바퀴에 타고파</div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| const meta: Meta<typeof TypographyScale> = { | ||
| title: "Base/Typography", | ||
| component: TypographyScale, | ||
| parameters: { layout: "padded" }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| export const Scale: StoryObj<typeof TypographyScale> = {}; |
This file contains hidden or 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,9 @@ | ||
| export const typography = { | ||
| h1: { fontSize: "32px", lineHeight: "40px", fontWeight: 700 }, | ||
| h2: { fontSize: "24px", lineHeight: "32px", fontWeight: 700 }, | ||
| h3: { fontSize: "20px", lineHeight: "28px", fontWeight: 600 }, | ||
| body: { fontSize: "16px", lineHeight: "24px", fontWeight: 400 }, | ||
| caption: { fontSize: "13px", lineHeight: "18px", fontWeight: 400 }, | ||
| } as const; | ||
|
|
||
| export type TypographyToken = keyof typeof typography; |
This file contains hidden or 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,2 @@ | ||
| export * from "./base/index"; | ||
| export * from "./semantic/index"; |
Empty file.
This file contains hidden or 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,16 @@ | ||
| import { baseColor } from "../base/color"; | ||
|
|
||
| export const semanticColor = { | ||
| background: baseColor.white, | ||
| backgroundSubtle: baseColor.gray50, | ||
| foreground: baseColor.gray900, | ||
| foregroundMuted: baseColor.gray600, | ||
| border: baseColor.gray200, | ||
| primary: baseColor.blue500, | ||
| primaryHover: baseColor.blue600, | ||
| danger: baseColor.red500, | ||
| success: baseColor.green500, | ||
| warning: baseColor.yellow500, | ||
| } as const; | ||
|
|
||
| export type SemanticColor = keyof typeof semanticColor; |
This file contains hidden or 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,24 @@ | ||
| :root { | ||
| --color-background: #ffffff; | ||
| --color-foreground: #191f28; | ||
| --color-foreground-muted: #6b7684; | ||
| --color-border: #e5e8eb; | ||
| --color-primary: #3182f6; | ||
| --color-primary-hover: #2272eb; | ||
| --color-danger: #f04452; | ||
|
|
||
| --space-1: 2px; | ||
| --space-2: 4px; | ||
| --space-3: 8px; | ||
| --space-4: 12px; | ||
| --space-5: 16px; | ||
| --space-6: 20px; | ||
| --space-7: 24px; | ||
| --space-8: 32px; | ||
|
|
||
| --radius-sm: 4px; | ||
| --radius-md: 8px; | ||
| --radius-lg: 12px; | ||
|
|
||
| --font-body: 16px; | ||
| } |
This file contains hidden or 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,7 @@ | ||
| { | ||
| "extends": "@makers/tsconfig/library.json", | ||
| "compilerOptions": { | ||
| "types": ["react"] | ||
| }, | ||
| "include": ["src"] | ||
| } |
This file contains hidden or 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 hidden or 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,53 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
| import { Button } from "./Button"; | ||
|
|
||
| const meta: Meta<typeof Button> = { | ||
| title: "Button", | ||
| component: Button, | ||
| tags: ["autodocs"], | ||
| args: { | ||
| children: "버튼", | ||
| variant: "primary", | ||
| size: "md", | ||
| }, | ||
| argTypes: { | ||
| variant: { | ||
| control: "inline-radio", | ||
| options: ["primary", "secondary", "danger"], | ||
| }, | ||
| size: { | ||
| control: "inline-radio", | ||
| options: ["sm", "md", "lg"], | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof Button>; | ||
|
|
||
| export const Primary: Story = {}; | ||
|
|
||
| export const Secondary: Story = { | ||
| args: { variant: "secondary" }, | ||
| }; | ||
|
|
||
| export const Danger: Story = { | ||
| args: { variant: "danger" }, | ||
| }; | ||
|
|
||
| export const Sizes: Story = { | ||
| render: (args) => ( | ||
| <div style={{ display: "flex", gap: 12, alignItems: "center" }}> | ||
| <Button {...args} size="sm"> | ||
| Small | ||
| </Button> | ||
| <Button {...args} size="md"> | ||
| Medium | ||
| </Button> | ||
| <Button {...args} size="lg"> | ||
| Large | ||
| </Button> | ||
| </div> | ||
| ), | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.