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

fix(web-domains): 자기소개, 코멘트 validation 수정 #182

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export const Comment = ({ comment, onChangeComment }: CommentProps) => {
<CommentInput
value={comment}
onChange={onChangeComment}
maxLength={20}
errors={{ maxLength: 20 }}
maxLength={100}
errors={{ maxLength: 100 }}
css={{ marginTop: '24px' }}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export const CommentInput = forwardRef<HTMLInputElement, CommentInputProps>(

const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const { value } = e.target;
setInput(value);
onChange?.(value);
setInput(value.substring(0, maxLength));
onChange?.(value.substring(0, maxLength));
};

const handleReset = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const TextField = forwardRef<HTMLInputElement, PropsWithChildren<InputPro
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
if (maxLength && event.target.value.length > maxLength) {
event.target.value = event.target.value.slice(0, maxLength);
return;
}
onChange && onChange(event);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const ExtraInfoForm = () => {
required: true,
minLength: 1,
maxLength: 15,
pattern: /^\S.*\S$/,
validate: (value) => (value.trim().length >= 1 ? true : false),
})}
/>
<TextInput
Expand All @@ -69,7 +69,7 @@ export const ExtraInfoForm = () => {
required: true,
minLength: 1,
maxLength: 15,
pattern: /^\S.*\S$/,
validate: (value) => (value.trim().length >= 1 ? true : false),
})}
/>
<div css={buttonWrapperCss}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export const IntroInfoForm = () => {
<TextArea
maxLength={MAX_LENGTH}
placeholder="저는 이런 사람이에요"
{...register('introduction', { maxLength: MAX_LENGTH, pattern: /^\S.*\S$/ })}
{...register('introduction', {
maxLength: MAX_LENGTH,
validate: (value) => (value.trim().length >= 1 ? true : false),
})}
/>
<Txt as="p" typography="body4" color={colors.grey600}>
최대 {MAX_LENGTH}자까지 입력해주세요
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>((props, r

const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
if (maxLength && event.target.value.length > maxLength) {
event.target.value = event.target.value.slice(0, maxLength);
event.target.value = event.target.value.substring(0, maxLength);
return;
}
onChange && onChange(event);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const TextInput = forwardRef<HTMLInputElement, TextInputProps>((props, re
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
if (maxLength && event.target.value.length > maxLength) {
event.target.value = event.target.value.slice(0, maxLength);
return;
}
onChange && onChange(event);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export const ModifyIntroForm = () => {
<TextArea
placeholder="저는 이런 사람이에요."
maxLength={MAX_LENGTH}
{...register('introduction', { maxLength: MAX_LENGTH, pattern: /^\S.*\S$/ })}
{...register('introduction', {
maxLength: MAX_LENGTH,
validate: (value) => (value.trim().length >= 1 ? true : false),
})}
/>
<Txt as="p" typography="body4" color={colors.grey600}>
최대 {MAX_LENGTH}자까지 입력해주세요
Expand Down
Loading