From b89ec15a6e21c85b6a40826925c2a6153099aaa8 Mon Sep 17 00:00:00 2001 From: ChanLee_KR Date: Fri, 2 Aug 2024 16:10:10 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B4=80=EC=8B=AC=EC=82=AC=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=20=EB=B0=95=EC=8A=A4=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=A0=91=EA=B7=BC=EC=84=B1=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0=20(#ATR-582)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sign-up/ui/UserPreferTagField.tsx | 86 +++++++++++-------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/apps/service/src/features/sign-up/ui/UserPreferTagField.tsx b/apps/service/src/features/sign-up/ui/UserPreferTagField.tsx index c73694bd..db86c6cf 100644 --- a/apps/service/src/features/sign-up/ui/UserPreferTagField.tsx +++ b/apps/service/src/features/sign-up/ui/UserPreferTagField.tsx @@ -1,22 +1,20 @@ -/* eslint-disable jsx-a11y/label-has-associated-control */ -import { getCategorySVG } from '@/entities/profile' -import { NEWSLETTER_CATEGORY } from '@/shared/constant' -import { NewsletterCategory } from '@/shared/type' -import { CheckOutline, ComputerEmoji } from '@attraction/icons' import { useEffect, useMemo, useState } from 'react' import { useFormContext } from 'react-hook-form' -import { WarnTxt } from '@/shared/ui' +import { CheckOutline, ComputerEmoji } from '@attraction/icons' import { Badge } from '@attraction/design-system/dist' +import { twcn } from '@attraction/utils' +import { getCategorySVG } from '@/entities/profile' +import { NEWSLETTER_CATEGORY } from '@/shared/constant' +import type { NewsletterCategory } from '@/shared/type' +import { WarnTxt } from '@/shared/ui' import { useDisabledBtn } from '../lib' import { SignUpFormType } from '../model' interface UserPreferTagType { - categoryKey: keyof typeof NEWSLETTER_CATEGORY + categoryKey: NewsletterCategory disabledTag: boolean - preferTagList: (keyof typeof NEWSLETTER_CATEGORY)[] - setPreferTagList: React.Dispatch< - React.SetStateAction<(keyof typeof NEWSLETTER_CATEGORY)[]> - > + preferTagList: NewsletterCategory[] + setPreferTagList: React.Dispatch> } function UserPreferTag({ @@ -30,7 +28,6 @@ function UserPreferTag({ clearErrors, formState: { errors }, } = useFormContext() - // TODO: 이모티콘 깜박임 문제 해결하기 (필수!!!) const CategoryEmoji = useMemo( () => getCategorySVG(NEWSLETTER_CATEGORY[categoryKey]), [categoryKey], @@ -52,31 +49,52 @@ function UserPreferTag({ } return ( -
+
  • - -
  • + + ) } @@ -86,9 +104,9 @@ export default function UserPreferTagField() { formState: { errors }, getValues, } = useFormContext() - const [preferTagList, setPreferTagList] = useState< - (keyof typeof NEWSLETTER_CATEGORY)[] - >(getValues('interest')) + const [preferTagList, setPreferTagList] = useState( + getValues('interest'), + ) const { disabledTag } = useDisabledBtn(preferTagList) @@ -113,7 +131,7 @@ export default function UserPreferTagField() {
    -
    +
      {Object.keys(NEWSLETTER_CATEGORY).map((categoryKey) => ( ))} -
    +
    {errors.interest?.message && (