diff --git a/src/app/post-meetup/page.tsx b/src/app/post-meetup/page.tsx index 5e391a57..810ca530 100644 --- a/src/app/post-meetup/page.tsx +++ b/src/app/post-meetup/page.tsx @@ -74,13 +74,7 @@ const PostMeetupPage = () => { } name='tags' /> - { - console.log(form.state.fieldMeta.maxParticipants?.isValid); - - form.handleSubmit(); - }} - /> + form.handleSubmit()} /> ); diff --git a/src/components/pages/post-meetup/fields/tags-field/index.tsx b/src/components/pages/post-meetup/fields/tags-field/index.tsx index 497bc364..4ea6b407 100644 --- a/src/components/pages/post-meetup/fields/tags-field/index.tsx +++ b/src/components/pages/post-meetup/fields/tags-field/index.tsx @@ -20,13 +20,15 @@ export const MeetupTagsField = ({ field }: Props) => { if (e.code !== 'Enter' && e.code !== 'NumpadEnter') return; if (e.nativeEvent.isComposing) return; - const hasDupe = field.state.value.includes(inputValue); + const isUniqueTag = !field.state.value.includes(inputValue); + const nonEmpty = inputValue.trim(); + const tagsCount = field.state.value.length; - if (!hasDupe && inputValue.trim()) { + if (isUniqueTag && nonEmpty && tagsCount < 10) { field.pushValue(inputValue); } - if (inputRef.current) inputRef.current.focus(); + inputRef.current?.focus(); setInputValue(''); }; @@ -45,6 +47,7 @@ export const MeetupTagsField = ({ field }: Props) => { height={20} /> } + maxLength={8} placeholder='입력 후 Enter' type='text' value={inputValue}