-
Notifications
You must be signed in to change notification settings - Fork 0
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
[#3] design tokens & Common Components #5
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4e9609a
add: design tokens
kweonsikyung ee8f998
fix: yarn 관련 gitignore 설정
kweonsikyung 6829bca
add: Button Components
kweonsikyung 9897812
fix: COLORS 변수명 변경에 따른 버튼 컴포넌트 수정
kweonsikyung f412046
add: Status Components
kweonsikyung 10e17de
add: Category Component
kweonsikyung a477e3b
Merge branch 'main' of https://github.com/DaITssu/daitssu-client into…
kweonsikyung 3f03962
fix: 폰트 적용, 변수명을 포함한 디자인시스템 디테일 수정
kweonsikyung 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
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,19 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Button from './Button'; | ||
|
||
const meta: Meta<typeof Button> = { | ||
title: 'Button', | ||
component: Button, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Button>; | ||
|
||
export const Primary: Story = { | ||
args: { | ||
label: '완료', | ||
width: 358, | ||
height: 56, | ||
}, | ||
}; |
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,19 @@ | ||
import { COLORS } from '../../../styles/constants/colors'; | ||
import styled from '@emotion/styled'; | ||
|
||
// 가독성을 위해 스타일 파일은 별도로 둡니다. | ||
|
||
interface ButtonProps { | ||
width?: number; | ||
height?: number; | ||
} | ||
|
||
export const Button = styled.div<ButtonProps>` | ||
width: ${(props) => (props.width ? `${props.width}px` : '358px')}; | ||
height: ${(props) => (props.height ? `${props.height}px` : '56px')}; | ||
line-height: ${(props) => (props.height ? `${props.height}px` : '56px')}; | ||
border-radius: 12px; | ||
text-align: center; | ||
color: ${COLORS.grayscale.white}; | ||
background-color: ${COLORS.SSU.primary}; | ||
`; |
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,16 @@ | ||
import * as styles from './Button.styles'; | ||
|
||
interface ButtonProps { | ||
label?: string; | ||
width?: number; | ||
height?: number; | ||
onClick?: () => void; | ||
} | ||
|
||
const Button = ({ label, width, height, onClick }: ButtonProps) => ( | ||
<styles.Button width={width} height={height} onClick={onClick}> | ||
{label} | ||
</styles.Button> | ||
); | ||
|
||
export default Button; |
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,3 @@ | ||
import Button from './Button'; | ||
|
||
export default Button; | ||
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,18 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Category from './Category'; | ||
|
||
const meta: Meta<typeof Category> = { | ||
title: 'Category', | ||
component: Category, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Category>; | ||
|
||
export const BgColor: Story = { | ||
args: { | ||
label: '전체', | ||
BgColor: true, | ||
}, | ||
}; |
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,26 @@ | ||
import { COLORS } from '../../../styles/constants/colors'; | ||
import styled from '@emotion/styled'; | ||
import { TEXT_STYLES } from '../../../styles/constants/textStyles'; | ||
|
||
// 가독성을 위해 스타일 파일은 별도로 둡니다. | ||
|
||
interface CategoryProps { | ||
/** 상태값 종류, true->채워진 배경 | false->흰 배경 */ | ||
BgColor: boolean; | ||
} | ||
|
||
export const Category = styled.div<CategoryProps>` | ||
height: 35px; | ||
padding: 0 15px; | ||
line-height: 35px; | ||
border-radius: 20px; | ||
text-align: center; | ||
display: inline-block; | ||
color: ${(props) => | ||
props.BgColor ? COLORS.grayscale.white : COLORS.SSU.primary}; | ||
background-color: ${(props) => | ||
props.BgColor ? COLORS.SSU.primary : COLORS.grayscale.white}; | ||
border: 1px solid | ||
${(props) => (props.BgColor ? COLORS.SSU.primary : COLORS.SSU.primary)}; | ||
${TEXT_STYLES.CapM14}; | ||
`; |
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,12 @@ | ||
import * as styles from './Category.styles'; | ||
|
||
interface CategoryProps { | ||
label?: string; | ||
BgColor: boolean; | ||
} | ||
|
||
const Category = ({ label, BgColor }: CategoryProps) => ( | ||
<styles.Category BgColor={BgColor}>{label}</styles.Category> | ||
); | ||
|
||
export default Category; |
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,3 @@ | ||
import Category from './Category'; | ||
|
||
export default Category; |
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,32 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Status from './Status'; | ||
|
||
const meta: Meta<typeof Status> = { | ||
title: 'Status', | ||
component: Status, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Status>; | ||
|
||
export const isIncomplete: Story = { | ||
args: { | ||
label: '미완료', | ||
status: 0, | ||
}, | ||
}; | ||
|
||
export const isComplete: Story = { | ||
args: { | ||
label: '완료', | ||
status: 1, | ||
}, | ||
}; | ||
|
||
export const isTimeout: Story = { | ||
args: { | ||
label: '시간 초과', | ||
status: 2, | ||
}, | ||
}; |
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 { COLORS } from '../../../styles/constants/colors'; | ||
import styled from '@emotion/styled'; | ||
import { TEXT_STYLES } from '../../../styles/constants/textStyles'; | ||
|
||
// 가독성을 위해 스타일 파일은 별도로 둡니다. | ||
|
||
interface StatusProps { | ||
/** 상태값 종류, 0->미완료 | 1->완료 | 2->시간초과. */ | ||
status: number; | ||
} | ||
|
||
export const Status = styled.div<StatusProps>` | ||
height: 20px; | ||
padding: 0 10px; | ||
line-height: 20px; | ||
border-radius: 12px; | ||
text-align: center; | ||
display: inline-block; | ||
color: ${COLORS.grayscale.white}; | ||
background-color: ${(props) => { | ||
switch (props.status) { | ||
case 0: | ||
return COLORS.SSU.error; | ||
case 1: | ||
return COLORS.SSU.primary; | ||
case 2: | ||
return COLORS.grayscale.Gray1; | ||
} | ||
}}; | ||
${TEXT_STYLES.CapM12}; | ||
`; |
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,15 @@ | ||
import * as styles from './Status.styles'; | ||
|
||
interface StatusProps { | ||
label?: string; | ||
status: number; | ||
onClick?: () => void; | ||
} | ||
|
||
const Status = ({ label, status, onClick }: StatusProps) => ( | ||
<styles.Status status={status} onClick={onClick}> | ||
{label} | ||
</styles.Status> | ||
); | ||
|
||
export default Status; |
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,3 @@ | ||
import Status from './Status'; | ||
|
||
export default Status; |
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,4 @@ | ||
import Button from '../Button'; | ||
import * as styles from './Test.style'; | ||
|
||
interface TestProps { | ||
|
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,18 @@ | ||
export const COLORS = { | ||
SSU: { | ||
primary: '#5ebeeb', | ||
secondary: '#e7f5fc', | ||
error: '#f36262', | ||
accept: '#7AC364', | ||
yellow: '#FFD057', | ||
}, | ||
grayscale: { | ||
white: '#FFFFFF', | ||
Gray1: '#6E6E6E', | ||
Gray2: '#BDBDBD', | ||
Gray3: '#D9D9D9', | ||
Gray4: '#EEEEEE', | ||
Gray5: '#F9F9F9', | ||
Black: '#313131', | ||
}, | ||
}; |
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,79 @@ | ||
export const TEXT_STYLES = { | ||
//Nav M 10 | ||
NavM10: { | ||
fontSize: 10, | ||
fontWeight: 500, | ||
letterSpacing: -0.11, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Caption R 12 | ||
CapR12: { | ||
fontSize: 12, | ||
fontWeight: 400, | ||
letterSpacing: -0.132, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Caption M 12 | ||
CapM12: { | ||
fontSize: 12, | ||
fontWeight: 500, | ||
letterSpacing: -0.132, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Caption R 14 | ||
CapR14: { | ||
fontSize: 14, | ||
fontWeight: 400, | ||
letterSpacing: -0.154, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Caption M 14 | ||
CapM14: { | ||
fontSize: 14, | ||
fontWeight: 500, | ||
letterSpacing: -0.154, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Body R 16 | ||
BodyR16: { | ||
fontSize: 16, | ||
fontWeight: 400, | ||
letterSpacing: -0.176, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Body M 16 | ||
BodyM16: { | ||
fontSize: 16, | ||
fontWeight: 500, | ||
letterSpacing: -0.176, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Head M 20 | ||
HeadM20: { | ||
fontSize: 14, | ||
fontWeight: 400, | ||
letterSpacing: -0.154, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Head SM 20 | ||
HeadSM20: { | ||
fontSize: 20, | ||
fontWeight: 600, | ||
letterSpacing: -0.22, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Button M 18 | ||
BtnM18: { | ||
fontSize: 18, | ||
fontWeight: 500, | ||
letterSpacing: -0.198, | ||
fontFamily: 'Pretendard', | ||
}, | ||
//Button SB 18 | ||
BtnSB18: { | ||
fontSize: 18, | ||
fontWeight: 600, | ||
letterSpacing: -0.198, | ||
fontFamily: 'Pretendard', | ||
}, | ||
}; |
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.
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.
📌 제가 잘 몰라서 그런데 나중에 Button 컴포넌트 쓸 때 최종적으로 이거 가져다 쓰면 되는거죵??!
💕 디자인 시스템 컴포넌트로 관리하는거 너무 좋은것 같네요! 양이 많았을텐데 수고했어요오! 혹시 하다 힘들면 남은 부분 같이 도울게요! 13일 이후로는 할 수 있을것 같아용
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.
넹 import 하시고
<Button width={} height={} label="hello world" onClick={} />
요런식으로 props 맞춰서 사용해주시면 됩니다!!