-
Notifications
You must be signed in to change notification settings - Fork 66
[클린코드 리액트 3기 정진범] 페이먼츠 미션 Step3 #159
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
base: jungjinbeom
Are you sure you want to change the base?
Changes from 20 commits
9ff4c10
5f29bb5
0924b64
122daa2
4cd3623
3295a14
aedfe7d
d79e9d8
b7bc9ca
b12a25e
b64ca45
cb3f051
b4dc5cf
1c54168
68eb150
5bae1a9
db1c4d2
2655062
2e1c2a2
2b699a8
2f39969
e2ea372
5aa5572
0ba4fe6
bcf9105
12df3c4
2e456dc
6fba43b
b2b1123
63ebfd4
9b55a26
d11174f
7ab4aa6
b87daaf
8960a2f
1a8e18a
a834c1f
598c22f
55d1411
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 |
---|---|---|
@@ -1,25 +1,15 @@ | ||
import CardList from './pages/card-list/CardList'; | ||
import AddCard from './pages/card-add/AddCard'; | ||
import CardRegisterComplete from './pages/card-register-complete/CardRegisterComplete'; | ||
import CardInfoProvider from './provider/card-info-provider/CardInfoProvider'; | ||
import MyCardsProvider from './provider/my-cards-provider/MyCardsProvider'; | ||
import Stepper from './pages/Stepper'; | ||
import CardInfoProvider from './pages/card-add/components/card-form/card-password/CardInfoProvider'; | ||
|
||
import StepProvider from './provider/step-provider/StepProvider'; | ||
|
||
const App = () => ( | ||
<div className="root"> | ||
<MyCardsProvider> | ||
<CardInfoProvider> | ||
<StepProvider> | ||
{(route) => ( | ||
<> | ||
{'LIST' === route && <CardList />} | ||
<CardInfoProvider> | ||
{'CARD' === route && <AddCard />} | ||
{'COMPLETE' === route && <CardRegisterComplete />} | ||
</CardInfoProvider> | ||
</> | ||
)} | ||
<Stepper /> | ||
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. 훨씬 선언적으로 되었네요 👍 |
||
</StepProvider> | ||
</MyCardsProvider> | ||
</CardInfoProvider> | ||
</div> | ||
); | ||
|
||
|
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import CardBox from './parts/CardBox'; | ||
import CardForm from './parts/CardForm'; | ||
|
||
interface EmptyCardProps { | ||
type EmptyCardProps = { | ||
onClick: () => void; | ||
} | ||
const EmptyCard = ({ onClick }: EmptyCardProps) => { | ||
return ( | ||
<CardBox onClick={onClick}> | ||
<CardForm status="empty"> | ||
<div>+</div> | ||
</CardForm> | ||
</CardBox> | ||
); | ||
}; | ||
const EmptyCard = ({ onClick }: EmptyCardProps) => ( | ||
<CardBox onClick={onClick}> | ||
<CardForm status="empty"> | ||
<div>+</div> | ||
</CardForm> | ||
</CardBox> | ||
); | ||
|
||
export default EmptyCard; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as Card } from './Card'; | ||
export { default as EmptyCard } from './EmptyCard'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { PropsWithChildren } from 'react'; | ||
import { type PropsWithChildren } from 'react'; | ||
|
||
const CardBottom = ({ children }: PropsWithChildren) => { | ||
return <div className="card-bottom">{children}</div>; | ||
}; | ||
const CardBottom = ({ children }: PropsWithChildren) => ( | ||
<div className="card-bottom">{children}</div> | ||
); | ||
|
||
export default CardBottom; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import { PropsWithChildren } from 'react'; | ||
import { type PropsWithChildren } from 'react'; | ||
|
||
interface CardBoxProps extends PropsWithChildren { | ||
type CardBoxProps = { | ||
onClick?: () => void; | ||
} | ||
const CardBox = ({ onClick, children }: CardBoxProps) => { | ||
return ( | ||
<div onClick={onClick} className="card-box"> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
} & PropsWithChildren; | ||
const CardBox = ({ onClick, children }: CardBoxProps) => ( | ||
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. 여전히 앱 전체적으로 공백 없이 코드가 이어지는 부분이 많네요! |
||
<div onClick={onClick} className="card-box"> | ||
{children} | ||
</div> | ||
); | ||
|
||
export default CardBox; |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,11 +1,14 @@ | ||||||||
import classNames from 'classnames'; | ||||||||
import { PropsWithChildren } from 'react'; | ||||||||
|
||||||||
interface CardFormProps extends PropsWithChildren { | ||||||||
import { type DetailedHTMLProps, type HTMLAttributes, type PropsWithChildren } from 'react'; | ||||||||
type BaseCardFormProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>; | ||||||||
type CardFormProps = { | ||||||||
status: string; | ||||||||
} | ||||||||
const CardForm = ({ status, children }: CardFormProps) => { | ||||||||
return <div className={classNames(`${status}-card`)}>{children}</div>; | ||||||||
}; | ||||||||
} & BaseCardFormProps & | ||||||||
PropsWithChildren; | ||||||||
|
} & BaseCardFormProps & | |
PropsWithChildren; | |
} & PropsWithChildren<BaseCardFormProps>; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { CardNumbersType } from '@/domain/type'; | ||
import { type CardNumbersType } from '@/domain/type'; | ||
import CardText from './CardText'; | ||
|
||
const REGEX = /[1-9]/gi; | ||
interface CardNumbersProps extends CardNumbersType { | ||
type CardNumbersProps = { | ||
status: 'big' | 'small' | 'empty'; | ||
} | ||
} & CardNumbersType; | ||
const CardNumbers = ({ | ||
status, | ||
first = '', | ||
second = '', | ||
third = '', | ||
fourth = '', | ||
|
||
}: CardNumbersProps) => { | ||
return ( | ||
<div className="card-bottom__number"> | ||
<CardText | ||
status={status} | ||
>{`${first} ${second} ${third.replace(REGEX, '*')} ${fourth.replace(REGEX, '*')}`}</CardText> | ||
</div> | ||
); | ||
}; | ||
}: CardNumbersProps) => ( | ||
<div className="card-bottom__number"> | ||
<CardText | ||
status={status} | ||
>{`${first} ${second} ${third.replace(REGEX, '*')} ${fourth.replace(REGEX, '*')}`}</CardText> | ||
</div> | ||
); | ||
|
||
export default CardNumbers; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import classNames from 'classnames'; | ||
import { DetailedHTMLProps, PropsWithChildren } from 'react'; | ||
import { type DetailedHTMLProps, type PropsWithChildren } from 'react'; | ||
|
||
type BaseCardTextProps = DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>; | ||
interface CardTextProps extends BaseCardTextProps, PropsWithChildren { | ||
type CardTextProps = { | ||
status: string; | ||
} | ||
} & BaseCardTextProps & | ||
PropsWithChildren; | ||
|
||
const CardText = ({ status, children }: CardTextProps) => { | ||
return ( | ||
<span className={classNames(status === 'big' ? 'card-text__big' : 'card-text')}> | ||
{children} | ||
</span> | ||
); | ||
}; | ||
const CardText = ({ status, children }: CardTextProps) => ( | ||
<span className={classNames(status === 'big' ? 'card-text__big' : 'card-text')}>{children}</span> | ||
); | ||
|
||
export default CardText; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import { PropsWithChildren } from 'react'; | ||
import { type PropsWithChildren } from 'react'; | ||
|
||
const CardTitle = ({ children }: PropsWithChildren) => { | ||
return <div className="card-top">{children}</div>; | ||
}; | ||
const CardTitle = ({ children }: PropsWithChildren) => <div className="card-top">{children}</div>; | ||
|
||
export default CardTitle; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import classNames from 'classnames'; | ||
|
||
interface ChipProps { | ||
type ChipProps = { | ||
status: 'small' | 'big' | 'empty'; | ||
} | ||
const Chip = ({ status }: ChipProps) => { | ||
return <div className={classNames(status === 'big' ? 'big-card__chip' : 'small-card__chip')} />; | ||
}; | ||
const Chip = ({ status }: ChipProps) => ( | ||
<div className={classNames(status === 'big' ? 'big-card__chip' : 'small-card__chip')} /> | ||
); | ||
|
||
export default Chip; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import classNames from 'classnames'; | ||
import { DetailedHTMLProps, HTMLAttributes, PropsWithChildren } from 'react'; | ||
import { type DetailedHTMLProps, type HTMLAttributes, type PropsWithChildren } from 'react'; | ||
|
||
type BaseButtonBox = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>; | ||
interface ButtonBoxProps extends BaseButtonBox, PropsWithChildren {} | ||
type ButtonBoxProps = Record<string, unknown> & BaseButtonBox & PropsWithChildren; | ||
|
||
const ButtonBox = ({ className, children }: ButtonBoxProps) => { | ||
return <div className={classNames(className, 'button-box')}>{children}</div>; | ||
}; | ||
const ButtonBox = ({ className, children }: ButtonBoxProps) => ( | ||
<div className={classNames(className, 'button-box')}>{children}</div> | ||
); | ||
|
||
export default ButtonBox; |
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.
사용하지 않는 룰인데 주석 처리하고 삭제하는걸 깜빡햇습니다