From f018cbbfb45776a3df09a9dd4f908e75964b4a6a Mon Sep 17 00:00:00 2001 From: Seoyoung Date: Mon, 18 Nov 2024 17:56:30 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20=ED=83=9C=EA=B7=B8=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=20=EB=B0=A9=EB=B2=95=EC=97=90=20=EC=BD=A4=EB=A7=88=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/list/create/_components/StepThree.tsx | 9 +++++++-- src/lib/constants/placeholder.ts | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/list/create/_components/StepThree.tsx b/src/app/list/create/_components/StepThree.tsx index fddd3eba..24f6d833 100644 --- a/src/app/list/create/_components/StepThree.tsx +++ b/src/app/list/create/_components/StepThree.tsx @@ -19,6 +19,8 @@ interface StepThreeProps { isSubmitting: boolean; } +//TODO: 태그입력에 대해 키보드 자판, 기종 별 테스트 필요 + export default function StepThree({ onBeforeClick, onNextClick, type, isSubmitting }: StepThreeProps) { const { language } = useLanguage(); @@ -66,9 +68,12 @@ export default function StepThree({ onBeforeClick, onNextClick, type, isSubmitti //Enter, Space 시 등록 const label = e.currentTarget.value; - const trimmedLabel = label.trim(); + let trimmedLabel = label.trim(); + if (trimmedLabel.endsWith(',')) { + trimmedLabel = trimmedLabel.slice(0, -1); + } - if ((e.key === 'Enter' || e.key === ' ') && trimmedLabel) { + if ((e.key === 'Enter' || e.key === ' ' || e.key === ',') && trimmedLabel) { e.preventDefault(); //영어,숫자,한글만 가능하게 처리 diff --git a/src/lib/constants/placeholder.ts b/src/lib/constants/placeholder.ts index 00393fa2..12815952 100644 --- a/src/lib/constants/placeholder.ts +++ b/src/lib/constants/placeholder.ts @@ -2,13 +2,13 @@ export const listPlaceholder = { ko: { title: '리스트 제목을 적어주세요', description: '리스트에 대한 간단한 소개를 작성해주세요.', - label: '태그 입력 후 Enter 또는 Space를 눌러 주세요.(최대 3개)', + label: '엔터, 스페이스 또는 쉼표를 눌러 등록하세요.(최대 3개)', collaborator: '닉네임을 입력해주세요.', }, en: { title: 'Please write down the title of the list', description: 'Please write a brief introduction to the list.', - label: 'Tap Enter or Space to add a tag (up to 3)', + label: 'Tap Enter, Space or Comma to add a tag (up to 3)', collaborator: 'Please write a nickname.', }, };