-
Notifications
You must be signed in to change notification settings - Fork 2
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
๐ TradeStateCard ์ปดํฌ๋ํธ ๊ตฌํ #24
Conversation
@@ -0,0 +1,59 @@ | |||
import formatDistanceToNow from 'date-fns/formatDistanceToNow' |
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.
์ฝ๋ฉ์ปจ๋ฒค์ ์ ํ๊ฑฐ ๋ค์๋ณด๋๊น ์ ํฌ ํด๋๋ช ์ ์ผ๋ฐฅ์ผ๋ก ํ๊ธฐ๋ก ํ๋๋ผ๊ณ ์!! ์ ๋ ๊ทธ๋์ suggest-card๋ก ํด๋๋ช ๋ณ๊ฒฝํ์ต๋๋ค!
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.
์ ๊ทธ๋ฌ๋ค์? ์ ๋ PR ๋ฐ๋ก ํด์ ์น ๋ฐ๊ฟ์ผ๊ฒ ์ด์
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.
์ ๊ทธ๋ฌ๋ค์ ใ ใ
src/types/index.ts
Outdated
@@ -0,0 +1,12 @@ | |||
export type Item = { |
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.
์๋ฒ์์ ๋ด๋ ค์ฃผ๋ data๋ค์ ๋ํ ๊ฒฝ์ฐ๋ interface๋ก ํ๊ธฐ๋ก ํ์์ด์!
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.
๋ฐ๋๋ก ์๊ณ ์์๋ค์ ๊ฐ์ฌํฉ๋๋ค
<CardFlex direction={'col'} justify={'between'} className="h-full"> | ||
<CardFlex align={'center'} gap={'space'}> | ||
<CardText type={'title'}>{cardTitle}</CardText> | ||
{renderBadgeByTradeState(tradeState)} |
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.
์ ๋ ์กฐ๊ฑด๋ถ๋ ๋๋งํ ๋ ์ผํญ์ฐ์ฐ์ ์ด์ฉํด์ ๋ ๋๋งํ๋๊ฒ ์ต์ํ๋ฐ ์ด๋ ๊ฒ ํจ์๋ก ๋ฐ๋ก ๋ด์๋๋ฉด ์ด๋ค ์ด์ ์ด ์๋์??? ์ ๋ ์ต์ํ์ง ์์ ๋ฐฉ๋ฒ์ด๋ผ ํธ๊ธฐ์ฌ์ ์ฌ์ญค๋ด ๋๋ค! ๊ถ๊ธ ๐ค
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.
๊ฑฐ๋์ํ์ ๋ฐ๋ผ ๋ฑ์ง๋ฅผ ๋ค๋ฅด๊ฒ ๋ ๋๋งํ๋ ๊ธฐ๋ฅ์ ๋ฌธ์ฅ์ ์ฝ์ผ๋ฉด ๋ฐ๋ก ์์ ์์ด์ ์ ๋ ๊ฒ ํด๋จ๋๋ฐ
์ฌ์ค ์ด๋ป๊ฒ ํ๋ ์๊ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ด๋ถ๋ถ๋ ๋
ผ์๊ฐ ํ์ํ ๊น์?
@@ -0,0 +1,59 @@ | |||
import formatDistanceToNow from 'date-fns/formatDistanceToNow' |
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.
์ ๊ทธ๋ฌ๋ค์? ์ ๋ PR ๋ฐ๋ก ํด์ ์น ๋ฐ๊ฟ์ผ๊ฒ ์ด์
const getStyleByTradeState = (tradeState: string) => | ||
tradeState === 'possible' ? 'primary' : 'secondary' | ||
const getTextByTradeState = (tradeState: string) => | ||
tradeState === 'possible' ? '๊ฑฐ๋๊ฐ๋ฅ' : '์์ฝ์ค' | ||
const renderBadgeByTradeState = (tradeState: string) => ( | ||
<Badge variant={getStyleByTradeState(tradeState)} size={'sm'}> | ||
{getTextByTradeState(tradeState)} | ||
</Badge> | ||
) |
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.
const badgeVariant = {
possible: {
style: 'primary',
text: '๊ฑฐ๋๊ฐ๋ฅ'
},
booked: {
style: 'secondary',
text: '์์ฝ์ค'
}
}
const getBadgeByType = (tradeState: 'possible' | 'booked') => (
<Badge variant={badgeVariant[tradeState].style}>
{badgeVariant[tradeState].text}
</Badge>
)
์ด๋ฐ ์์ ์ด๋จ๊น์?
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.
์ข๋ค์ map์ ์ธ๊น ๊ณ ๋ฏผ์ ํ๋ค๊ฐ, ์ํ๊ฐ ๋๊ฐ๋ผ ์ฃผ์ ํ๋๋ฐ ์ค์ฒฉ๋ map์ด๋ฉด ์์ธ์ด์ ๊ฐ ์๊ฒ ๋ค์
<CardFlex | ||
direction={'row'} | ||
justify={'start'} | ||
align={'center'} | ||
gap={'space'} | ||
className="h-full" | ||
> |
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.
ํน์ cardFlex
๋ ์ด๋ค ์ฉ๋์ผ๊น์??
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.
flex box๋ฅผ ๋๋ฆ ํธํ๊ฒ ์ฐ๋ ค๊ณ ์ ์ํ๋๋ฐ, ์จ๋ณด๋ ๊ตณ์ด ์ถ์ ๋ถ๋ถ์ด ์๋ ๊ฒ ๊ฐ๋ค์.
- ์ผํญ์ฐ์ฐ์๋ฅผ Map์ผ๋ก ๋ฐ๊ฟ
- ๋ชฉ์
=> ๋ฌผ๊ฑด ๋ฆฌ์คํธ ์กฐํ ํ์ด์ง์์ ์ฌ์ฉํ ๊ฑฐ๋์ํ๋ฅผ ํฌํจํ๊ณ ์๋ ์นด๋ ์ปดํฌ๋ํธ๊ฐ ํ์ํด ๊ตฌํํ์ต๋๋ค.
๊ด๋ จ ํฐ์ผ ๋ฒํธ: 60
- ์ฃผ์ ๋ณ๊ฒฝ ์ฌํญ
๊ธฐํ ์ฌํญ (์ ํ)
- ์คํฌ๋ฆฐ์ท (์ ํ)