-
Notifications
You must be signed in to change notification settings - Fork 1
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
typography 디자인 토큰 스토리 작성 #23
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import typography from "./typography"; | ||
|
||
const meta: Meta<typeof Text> = { | ||
title: "Design Tokens/Typography", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. - Components
- Button
- Design Tokens
- Typography 디자인 토큰 / 컴포넌트 그룹으로 나누면 좋을 거 같아서 우선 디자인 토큰만 폴더로 나눠봤습니다. 괜찮나요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아우 너무 좋아요 ㅎㅎ |
||
tags: ["autodocs"], | ||
component: Text, | ||
argTypes: { | ||
className: { | ||
control: { | ||
type: "radio", | ||
// radio label을 mm-semantic-typography-h1에서 h1로 변경 | ||
labels: Object.fromEntries( | ||
Object.entries(typography.$semantic).map(([key, value]) => [ | ||
value, | ||
key, | ||
]), | ||
), | ||
}, | ||
Comment on lines
+13
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ㅎㅎ 둘 다 좋아요! 보편적으로는 오른쪽이 보기 편한 것 같아요! 굿굿👍🏻 |
||
options: Object.values(typography.$semantic), | ||
}, | ||
}, | ||
excludeStories: /Text/, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Text>; | ||
|
||
export const Variants: Story = { | ||
args: { | ||
className: typography.$semantic.body1Bold, | ||
children: "Git challenge 디자인 시스템", | ||
}, | ||
}; | ||
|
||
export const Overview: Story = { | ||
parameters: { | ||
controls: { exclude: ["className", "children"] }, | ||
}, | ||
// render: () => {} 처럼 매개변수가 없으면, controls 필터링 기능이 동작하지 않는 문제가 있음 | ||
// https://github.com/storybookjs/storybook/issues/23343#issuecomment-1627351756 | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
render: (_) => ( | ||
<div style={{ display: "flex", flexDirection: "column", gap: "6px" }}> | ||
{Object.entries(typography.$semantic).map(([key, value]) => ( | ||
<Text className={value} key={key}> | ||
{key} | ||
</Text> | ||
))} | ||
</div> | ||
), | ||
}; | ||
|
||
type TypographySementicKey = keyof typeof typography.$semantic; | ||
|
||
export interface TextProps<Key extends TypographySementicKey> { | ||
/** className에 typography 토큰을 설정해 적용할 수 있습니다. */ | ||
className: (typeof typography.$semantic)[Key]; | ||
children: string; | ||
} | ||
|
||
export function Text<Key extends TypographySementicKey>({ | ||
Comment on lines
+58
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
className, | ||
children, | ||
}: TextProps<Key>) { | ||
return <div className={className}>{children}</div>; | ||
} |
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.
typography는 컴포넌트가 아니라서 docs가 없어도 괜찮을 거 같은데 어떻게 생각하시나요!
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.
저는 개인적으로 통일성때문에 있었으면 좋겠어요...😊
className에 적용해서 사용하면 된다는 간단한 설명 있으면 좋지 않을까요?
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.
좋습니다!! 반영했습니다 7bf8eba