-
Notifications
You must be signed in to change notification settings - Fork 1
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
[#414] [프로필] 프로필 수정 페이지 #426
Merged
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
e6e6aef
chore: tailwind config에 디렉토리 옵션 추가
hanyugeon e9133f4
chore: Storybook 프리뷰 내부 body에 padding 속성 제거
hanyugeon 1bf715e
chore: IconClose 기본 fill 속성 none으로 지정
hanyugeon 86f5010
refactor: TopNavigation 컴포넌트 position 옵션 수정
hanyugeon 2c50e92
feat: 내 정보 수정 페이지 마크업
hanyugeon 61d49bd
feat: 내 정보 수정 페이지 Storybook 작성
hanyugeon 9886011
feat: 내 정보 수정 페이지 기능 구현
hanyugeon 26a5a59
chore: 주석 추가
hanyugeon cd8cc68
refactor: Storybook args 추가 및 props 타입 정리
hanyugeon a3501da
refactor: InputLength 컴포넌트 분리
hanyugeon 0450b41
Merge branch 'main' of https://github.com/prgrms-web-devcourse/Team-0…
hanyugeon 0a78dcf
fix: Form에서 defaultValue가 안보이던 문제해결(스토리북 args 수정)
hanyugeon c841c33
fix: TopNavigation absolute 옵션 수정
hanyugeon 3d650ed
feat: Storybook에 Layout 추가
hanyugeon 2886de9
feat: 기존 EditMyProfilePage 교체
hanyugeon 3c3e7cf
fix: TopNavigation.CenterItem padding값 수정
hanyugeon bd2b45e
refactor: InputLength 컴포넌트 props 수정
hanyugeon d24e66b
refactor: InputLength 스토리북 수정
hanyugeon 2298bae
refactor: InputLength 컴포넌트의 리액트-훅-폼 종속성 제거
hanyugeon 75222a1
feat: ToastProvider 추가
hanyugeon f4278e4
feat: API 연동 및 기능 구현(라우팅, 토스트UI)
hanyugeon 6fe20e2
chore: 프로필 수정 페이지 스토리북 삭제
hanyugeon 191e9f9
fix: export default 컴포넌트 이름 수정
hanyugeon e56cb4c
refactor: InputLength 컴포넌트 currentLength props로 교체
hanyugeon 5322b22
refactor: 아이콘 라우팅 방식 변경 (useRouter -> next/Link)
hanyugeon fa84513
chore: TopNavigation 스타일 코드 컨벤션 수정
hanyugeon c01d8c9
fix: InputLength Storybook 수정
hanyugeon c9beef1
fix: InputLength props 타입에러 수정
hanyugeon c51289a
fix: InputLength 컴포넌트 undefined 처리방식 수정
hanyugeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
currentValue={watch('password')} | ||
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
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 = { | ||
currentValue: string; | ||
isError: boolean; | ||
maxLength: number; | ||
}; | ||
|
||
const InputLength = ({ | ||
currentValue = '', | ||
isError, | ||
maxLength, | ||
}: InputLengthProps) => { | ||
const currentLength = currentValue ? currentValue.length : 0; | ||
const textColor = isError ? 'text-warning-800 ' : 'text-main-900'; | ||
|
||
return ( | ||
<div> | ||
<span className={textColor}>{currentLength}</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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ const TopNavigation = ({ children }: TopNavigationProps) => { | |
|
||
const LeftItem = ({ children }: ItemProps) => { | ||
return ( | ||
<div className="absolute left-[2rem] [&_svg]:h-[2rem] [&_svg]:w-[2rem] [&_svg]:cursor-pointer"> | ||
<div className="absolute left-0 h-[2rem] [&_svg]:h-[2rem] [&_svg]:w-[2rem] [&_svg]:cursor-pointer"> | ||
{children} | ||
</div> | ||
); | ||
|
@@ -32,13 +32,15 @@ const textAligns = { | |
const CenterItem = ({ children, textAlign = 'center' }: CenterItemProps) => { | ||
const alignClassName = textAligns[textAlign]; | ||
return ( | ||
<div className={`w-full px-[3.5rem] ${alignClassName}`}>{children}</div> | ||
<div className={`h-[2rem] w-full px-[1.5rem] ${alignClassName}`}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
const RightItem = ({ children }: ItemProps) => { | ||
return ( | ||
<div className="absolute right-[2rem] flex gap-[1rem] [&_svg]:h-[2rem] [&_svg]:w-[2rem] [&_svg]:cursor-pointer"> | ||
<div className="absolute right-0 flex h-[2rem] gap-[1rem] [&_svg]:h-[2rem] [&_svg]:w-[2rem] [&_svg]:cursor-pointer"> | ||
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. 👍 |
||
{children} | ||
</div> | ||
); | ||
|
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
p5;
input value를 받지 않고 length를 바로 받아도 괜찮을 것 같네요!
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.
@minjongbaek
민종님 의견을 듣고 이전의 currentValue props가 컴포넌트의 역할과는 일관성이 떨어진다고 판단하여
currentValue > currentLength로 수정하였습니다! c51289a 👍