-
Notifications
You must be signed in to change notification settings - Fork 6
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
[Feat] 모각코 게시글 작성 폼 유효성 검사 #152
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e5542f9
:sparkles: Input, Textarea 글자수 표시 로직 삭제
LEEJW1953 62560ba
:sparkles: 모각코 게시글 작성 react hook form으로 관리
LEEJW1953 233c9e3
:label: Mogaco type 유틸리티 타입 사용
LEEJW1953 12ac181
:sparkles: 모각코 게시글 작성 관련 상수 분리
LEEJW1953 f2d3601
:sparkles: 모각코 게시글 작성 제목 컴포넌트 분리
LEEJW1953 e2ce7bc
:bug: Input 컴포넌트 value 속성 삭제
LEEJW1953 b9b5922
:sparkles: 모각코 게시글 작성 제목 컴포넌트 분리, 상수 사용
LEEJW1953 03d545d
:bug: Input, Textarea 속성 수정
LEEJW1953 93e2275
:label: 모각코 타입 수정
LEEJW1953 0f25ffa
:recycle: 작성 페이지 제목 관련 상수 사용
LEEJW1953 b22574e
:lipstick: 제목, 최대 인원 수 placeholder 변경
LEEJW1953 b660c32
:recycle: 삼항연산자 변경
LEEJW1953 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
43 changes: 43 additions & 0 deletions
43
app/frontend/src/components/MogacoPost/MogacoPostTitle.tsx
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,43 @@ | ||
import { Controller, Control } from 'react-hook-form'; | ||
|
||
import { MOGACO_POST } from '@/constants'; | ||
import { MogacoPostForm } from '@/types'; | ||
|
||
import * as styles from './index.css'; | ||
|
||
type MogacoPostTitleProps = { | ||
control: Control<MogacoPostForm>; | ||
}; | ||
|
||
export function MogacoPostTitle({ control }: MogacoPostTitleProps) { | ||
return ( | ||
<Controller | ||
control={control} | ||
name="title" | ||
rules={{ | ||
required: MOGACO_POST.TITLE.REQUIRED, | ||
maxLength: { | ||
value: MOGACO_POST.TITLE.MAX_LENGTH, | ||
message: MOGACO_POST.TITLE.MAX, | ||
}, | ||
}} | ||
render={({ field: { onChange, value }, fieldState: { error } }) => ( | ||
<div className={`${styles.titleContainer} ${error && styles.error}`}> | ||
<div className={styles.titleContent}> | ||
<input | ||
type="text" | ||
className={styles.title} | ||
placeholder={MOGACO_POST.TITLE.PLACEHOLDER} | ||
maxLength={MOGACO_POST.TITLE.MAX_LENGTH} | ||
onChange={onChange} | ||
/> | ||
<div className={styles.count}> | ||
{value ? value.length : 0}/{MOGACO_POST.TITLE.MAX_LENGTH} | ||
</div> | ||
</div> | ||
{error && <div className={styles.errorMessage}>{error.message}</div>} | ||
</div> | ||
)} | ||
/> | ||
); | ||
} |
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
Oops, something went wrong.
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.
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.
b660c32
수정하였습니다
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.
다른 데도 바꿀 수 있을 것 같아요~!