-
Notifications
You must be signed in to change notification settings - Fork 5
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
[FE] 참여자 입금 상태, 참여자 이름 Chip 컴포넌트 구현 #570
Changes from all commits
95f52f4
4ccc72d
9328178
47681dc
24f1da8
053e928
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,27 @@ | ||
import type {Meta, StoryObj} from '@storybook/react'; | ||
|
||
import DepositCheck from '@HDcomponents/DepositCheck/DepositCheck'; | ||
|
||
const meta = { | ||
title: 'Components/DepositCheck', | ||
component: DepositCheck, | ||
tags: ['autodocs'], | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
argTypes: { | ||
isDeposited: { | ||
description: '', | ||
control: {type: 'boolean'}, | ||
}, | ||
}, | ||
args: { | ||
isDeposited: false, | ||
}, | ||
} satisfies Meta<typeof DepositCheck>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Playground: Story = {}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {css} from '@emotion/react'; | ||
|
||
import {WithTheme} from '@components/Design/type/withTheme'; | ||
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. 오..! 이런 것도 있었구나. 모르고 있었는데 활용하면 너무 좋을 것 같아요! |
||
|
||
import {DepositCheckStyleProps} from './DepositCheck.type'; | ||
|
||
export const DepositCheckStyle = ({theme, isDeposited}: WithTheme<DepositCheckStyleProps>) => | ||
css({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: '0.125rem', | ||
border: `1px solid ${isDeposited ? theme.colors.primary : theme.colors.gray}`, | ||
borderRadius: '0.5rem', | ||
padding: '0.25rem 0.375rem', | ||
height: '1.25rem', | ||
|
||
'.deposit-check-text': { | ||
color: isDeposited ? theme.colors.primary : theme.colors.gray, | ||
paddingTop: '0.0625rem', | ||
}, | ||
Comment on lines
+17
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. 이런 식으로도 스타일을 적용할 수 있군요! NEW지식 습득.. 그런데 혹시 클래스로 스타일을 적용한 이유가 있을까요 ?! 제 추측으로는 하나의 css로 자식에 있는 Text까지 스타일을 적용하려고 해서 나눠진 것 같은데욧. color는 Text 컴포넌트에 준비되어있는 컬러 props를 사용하는 건 어떨지 제안드려봅니다!~ 굳이 싶다면 pass~~~!! |
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import {useTheme} from '@components/Design'; | ||
|
||
import Icon from '../Icon/Icon'; | ||
import Text from '../Text/Text'; | ||
|
||
import {DepositCheckStyle} from './DepositCheck.style'; | ||
import {DepositCheckProps} from './DepositCheck.type'; | ||
|
||
const DepositCheck: React.FC<DepositCheckProps> = ({isDeposited = false}: DepositCheckProps) => { | ||
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. 꼼꼼한 default ~~ 👍 |
||
const {theme} = useTheme(); | ||
return ( | ||
<div css={DepositCheckStyle({theme, isDeposited})}> | ||
<Text size="tiny" className="deposit-check-text"> | ||
입금 | ||
</Text> | ||
<Icon iconType={isDeposited ? 'check' : 'x'}></Icon> | ||
</div> | ||
); | ||
}; | ||
export default DepositCheck; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface DepositCheckStyleProps { | ||
isDeposited: boolean; | ||
} | ||
|
||
export interface DepositCheckCustomProps { | ||
isDeposited: boolean; | ||
} | ||
|
||
export type DepositCheckOptionProps = DepositCheckStyleProps & DepositCheckCustomProps; | ||
Comment on lines
+1
to
+9
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. isDeposited 프로퍼티가 DepositCheckStyleProps와 DepositCheckCustomProps에도 존재하는데 둘을 다시 &로 얽는게 혼란스러울 수도 있을 것 같은데요. 다른 방법을 생각해보자면 style에도 필요하고 이 컴포넌트가 받는 props에도 필요하다면 With~처럼 타입을 만들어서 사용해도 좋을 것 같구요. |
||
|
||
export type DepositCheckProps = React.ComponentProps<'div'> & DepositCheckOptionProps; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ const meta = { | |
iconType: { | ||
description: '', | ||
control: {type: 'select'}, | ||
options: ['inputDelete', 'buljusa', 'rightChevron', 'search', 'confirm', 'error', 'trash'], | ||
options: ['inputDelete', 'buljusa', 'rightChevron', 'search', 'confirm', 'error', 'trash', 'check', 'x'], | ||
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. 나중의 일이지만 사용하지 않는 아이콘 정리해봐도 좋을 것 같아요! |
||
}, | ||
}, | ||
args: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ export type IconType = | |
| 'error' | ||
| 'confirm' | ||
| 'trash' | ||
| 'check' | ||
| 'x' | ||
| 'toss' | ||
| 'meatballs'; | ||
|
||
|
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.
활용해주어서 고마어용~~
사실은 이런 타입 만든게 반복되니까 하나로 뭉쳐서 쓰자가 목적이었는데요. 이번에 용어 정리를 하면서 eventId -> eventToken으로 바뀌게 되었어요. 그리고 이 eventId라는 프로퍼티도 WIthEventId라는 타입으로 WithEvent와 동일한 형태로 사용할 수 있었는데요. 한번에 바꿀 수 있다는 점에서 유용함을 느꼈씁니다.!!