Skip to content
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

[2단계 - 페이먼츠] 렛서(김다은) 미션 제출합니다. #390

Merged
merged 40 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2c1fd73
refactor: errMsg -> errorMessage로 이름 변경
llqqssttyy Apr 23, 2024
1b9ab8c
refactor: 중복으로 관리되던 state 제거 및 validation 중복 로직 개선
llqqssttyy Apr 23, 2024
738d50c
feat: 카드사 입력 필드 추가
llqqssttyy Apr 24, 2024
c297b8b
refactor: Input 컴포넌트 타입 분리
llqqssttyy Apr 24, 2024
a221f66
feat: CVC 번호 입력 필드 추가
llqqssttyy Apr 24, 2024
570dd43
feat: cvc 번호 유효성 검사
llqqssttyy Apr 24, 2024
5bcb0bc
feat: 비밀번호 입력 필드
llqqssttyy Apr 24, 2024
d2ddd59
chore: #app의 height 정의 제거
llqqssttyy Apr 24, 2024
a339f15
feat: 카드 뒤집기 기능 추가
llqqssttyy Apr 25, 2024
3f785c9
feat: 카드 프리뷰에 cvc 번호 추가
llqqssttyy Apr 25, 2024
6f53d2d
refactor: getCardBrand 함수를 CardPreview 컴포넌트와 분리
llqqssttyy Apr 25, 2024
f185ec3
refactor: 카드사 선택에 따라 카드 프리뷰의 배경색이 바뀌는 기능
llqqssttyy Apr 25, 2024
81d4284
feat: 입력이 완료되면 다음 input으로 자동 포커싱되는 기능
llqqssttyy Apr 25, 2024
8537f50
refactor: 다음 필드 노출에 관한 정보를 담고 있는 상태 이름 변경 및 역할 분리
llqqssttyy Apr 26, 2024
d49c1f4
chore: 주석 제거
llqqssttyy Apr 26, 2024
9ea917d
refactor: useFormFieldFocus 훅의 매개변수로 길이를 받는 것으로 수정
llqqssttyy Apr 26, 2024
5d869b4
feat: 폼 제출 버튼 추가 및 라우팅
llqqssttyy Apr 26, 2024
a422959
refactor: 폼 전체의 유효성과 입력 진행 상황을 context에 추가
llqqssttyy Apr 27, 2024
0bc8d8b
feat: 등록 완료 페이지 추가
llqqssttyy Apr 27, 2024
b905bbf
fix: 비밀번호 입력 시 카드가 돌아가지 않는 버그
llqqssttyy Apr 27, 2024
9b007bd
feat: NotFound 페이지 추가
llqqssttyy Apr 27, 2024
ed93da3
test: 입력 필드 및 버튼 스토리 추가
llqqssttyy Apr 27, 2024
327af1d
test: Button 스토리 args 수정
llqqssttyy Apr 27, 2024
dd8ea71
chore: 불필요한 import 및 주석 제거
llqqssttyy Apr 27, 2024
1700782
fix: 만료 날짜 값이 없을 때 예외처리
llqqssttyy Apr 27, 2024
16096a6
fix: 타입 에러 수정
llqqssttyy Apr 27, 2024
9d8bc6d
chore: Storybook에 스타일 파일 임포트
llqqssttyy Apr 27, 2024
3d2ff54
chore: Select의 isRequired 기본값 주석 추가
llqqssttyy Apr 28, 2024
3fad8c2
refactor: 하나의 인풋을 가지는 필드의 name을 미리 선언해 타입 단언 없애기
llqqssttyy Apr 29, 2024
ee884af
refactor: early return으로 조건부 렌더링 명시하기
llqqssttyy Apr 29, 2024
b54c3d3
refactor: Password 컴포넌트 early return 조건부 렌더링 명시
llqqssttyy Apr 29, 2024
fa747e2
refactor: 핸들러 명명 체계 수정
llqqssttyy Apr 29, 2024
8fda2b2
refactor: INITIAL_VALUES 상수 타입 선언
llqqssttyy Apr 29, 2024
3ba23c2
chore: Button theme css 클래스 적용 및 스타일 변경
llqqssttyy Apr 29, 2024
b340eac
refactor: 카드 정보를 params로 전달하는 대신 state에 전달하도록 수정
llqqssttyy Apr 29, 2024
90c104b
feat: useAddCardFormContext에서 에러 발생 시 에러 페이지 노출
llqqssttyy Apr 29, 2024
dda438b
refactor: 필드에 전달되는 initial value에 대한 상수화 제거
llqqssttyy Apr 29, 2024
fdcfb6e
refactor: 변경된 핸들러 이름을 스토리북 코드에 적용
llqqssttyy Apr 29, 2024
9546f6a
refactor: 변경된 핸들러 이름을 select 스토리북 코드에 적용
llqqssttyy Apr 29, 2024
85100e7
refactor: useFormFieldFocus 내 useEffect 사용을 제거
llqqssttyy Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '../src/index.css';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아하 이친구가 범인이었군요 👮🏻

import type { Preview } from '@storybook/react';

const preview: Preview = {
Expand Down
126 changes: 115 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@types/react-router-dom": "^5.3.3",
"clsx": "^2.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-router-dom": "^6.23.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.3.3",
Expand Down
37 changes: 3 additions & 34 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,11 @@
import './index.css';
import styles from './App.module.css';

import { useState } from 'react';

import CardPreview from './components/CardPreview/CardPreview';
import CardNumberInput from './components/CardNumberInput/CardNumberInput';
import ExpirationDateInput from './components/ExpirationDateInput/ExpirationDateInput';
import OwnerNameInput from './components/OwnerNameInput/OwnerNameInput';
import { Outlet } from 'react-router-dom';

function App() {
const [cardInfo, setCardInfo] = useState<CardInfo>({
cardNumbers: ['', '', '', ''],
expirationDate: ['', ''],
ownerName: '',
});

const setCardData = (
key: keyof CardInfo,
newData: CardInfo[keyof CardInfo]
) => {
setCardInfo({ ...cardInfo, [key]: newData });
};

return (
<div className={styles.app}>
<h1 className={styles.title}>카드 추가</h1>

<CardPreview
cardNumbers={cardInfo.cardNumbers}
expirationDate={cardInfo.expirationDate}
ownerName={cardInfo.ownerName}
/>

<form>
<CardNumberInput setCardData={setCardData} />
<ExpirationDateInput setCardData={setCardData} />
<OwnerNameInput setCardData={setCardData} />
</form>
<div className="app">
<Outlet />
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.app {
.container {
position: relative;

display: flex;
flex-direction: column;
justify-content: center;
Expand All @@ -8,9 +10,14 @@
width: fit-content;

padding: 77px 30px 20px;
margin: auto;
}

.title {
visibility: hidden;
.srOnly {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
overflow: hidden;
}
Loading