-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: tailwind config에 디렉토리 옵션 추가 * chore: Storybook 프리뷰 내부 body에 padding 속성 제거 * chore: IconClose 기본 fill 속성 none으로 지정 * refactor: TopNavigation 컴포넌트 position 옵션 수정 * feat: 내 정보 수정 페이지 마크업 * feat: 내 정보 수정 페이지 Storybook 작성 * feat: 내 정보 수정 페이지 기능 구현 * chore: 주석 추가 * refactor: Storybook args 추가 및 props 타입 정리 * refactor: InputLength 컴포넌트 분리 * fix: Form에서 defaultValue가 안보이던 문제해결(스토리북 args 수정) * fix: TopNavigation absolute 옵션 수정 * feat: Storybook에 Layout 추가 * feat: 기존 EditMyProfilePage 교체 * fix: TopNavigation.CenterItem padding값 수정 * refactor: InputLength 컴포넌트 props 수정 * refactor: InputLength 스토리북 수정 * refactor: InputLength 컴포넌트의 리액트-훅-폼 종속성 제거 * feat: ToastProvider 추가 * feat: API 연동 및 기능 구현(라우팅, 토스트UI) * chore: 프로필 수정 페이지 스토리북 삭제 * fix: export default 컴포넌트 이름 수정 * refactor: InputLength 컴포넌트 currentLength props로 교체 * refactor: 아이콘 라우팅 방식 변경 (useRouter -> next/Link) * chore: TopNavigation 스타일 코드 컨벤션 수정 * fix: InputLength Storybook 수정 * fix: InputLength props 타입에러 수정 * fix: InputLength 컴포넌트 undefined 처리방식 수정
- Loading branch information
Showing
8 changed files
with
322 additions
and
29 deletions.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,76 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { SubmitHandler, useForm } from 'react-hook-form'; | ||
|
||
import Button from '@/ui/Base/Button'; | ||
import Input from '@/ui/Base/Input'; | ||
import InputLength from '@/ui/Base/InputLength'; | ||
import ErrorMessage from '@/ui/Base/ErrorMessage'; | ||
|
||
const meta: Meta<typeof InputLength> = { | ||
title: 'Base/InputLength', | ||
component: InputLength, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof InputLength>; | ||
|
||
type DefaultValues = { | ||
password: string; | ||
}; | ||
|
||
const InputLengthUseWithForm = () => { | ||
const { | ||
register, | ||
watch, | ||
handleSubmit, | ||
formState: { errors }, | ||
} = useForm<DefaultValues>({ | ||
mode: 'all', | ||
}); | ||
|
||
const handleSubmitForm: SubmitHandler<DefaultValues> = ({ password }) => { | ||
alert(`password: ${password}`); | ||
}; | ||
|
||
return ( | ||
<form | ||
onSubmit={handleSubmit(handleSubmitForm)} | ||
className="flex w-full flex-col gap-[1.6rem]" | ||
> | ||
<div className="flex flex-col gap-[0.5rem]"> | ||
<Input | ||
placeholder="비밀번호를 입력해주세요." | ||
{...register('password', { | ||
required: '필수 항목입니다.', | ||
minLength: { value: 2, message: '2자 이상 입력해 주세요.' }, | ||
maxLength: { value: 10, message: '10자 이하 입력해 주세요.' }, | ||
})} | ||
error={!!errors.password} | ||
/> | ||
<div className="flex flex-row-reverse justify-between gap-[0.4rem]"> | ||
<InputLength | ||
currentLength={watch('password')?.length} | ||
isError={!!errors.password} | ||
maxLength={10} | ||
/> | ||
{errors.password && ( | ||
<ErrorMessage>{errors.password.message}</ErrorMessage> | ||
)} | ||
</div> | ||
</div> | ||
<Button | ||
size="large" | ||
type="submit" | ||
onClick={handleSubmit(handleSubmitForm)} | ||
> | ||
Submit | ||
</Button> | ||
</form> | ||
); | ||
}; | ||
|
||
export const Default: Story = { | ||
render: () => <InputLengthUseWithForm />, | ||
}; |
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,22 @@ | ||
type InputLengthProps = { | ||
currentLength: number; | ||
isError: boolean; | ||
maxLength: number; | ||
}; | ||
|
||
const InputLength = ({ | ||
currentLength, | ||
isError, | ||
maxLength, | ||
}: InputLengthProps) => { | ||
const textColor = isError ? 'text-warning-800 ' : 'text-main-900'; | ||
|
||
return ( | ||
<div> | ||
<span className={textColor}>{currentLength ? currentLength : 0}</span>/ | ||
{maxLength} | ||
</div> | ||
); | ||
}; | ||
|
||
export default InputLength; |
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
Oops, something went wrong.