From f61cf0afa712aee42824f59afb485c390b796d15 Mon Sep 17 00:00:00 2001 From: CHOI GIHOAWN Date: Tue, 8 Oct 2024 14:07:46 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20cta=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=9D=B8=ED=84=B0=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EC=B6=94?= =?UTF-8?q?=EC=83=81=ED=99=94=20=EC=88=98=EC=A4=80=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../addPlant/NotificationToggle.tsx | 1 - .../addPlant/NotificationToggleList.tsx | 8 +------- .../addPlant/PlantLocationBadgeList.tsx | 9 ++------- ...4\353\254\274\354\244\200\353\202\240.tsx" | 4 +--- ...4\353\243\214\354\244\200\353\202\240.tsx" | 8 +------- ...4\354\236\221\355\225\234\353\202\240.tsx" | 20 ++++++++----------- src/components/common/CTAButton/index.tsx | 18 ++++++++--------- .../common/SegmentControl/index.tsx | 3 --- src/components/myPlant/DeleteConfirmation.tsx | 4 ++-- src/components/myPlant/LocationInput.tsx | 9 +-------- src/components/profile/ModifyNickname.tsx | 8 +------- src/components/profile/UseInformation.tsx | 13 ++++-------- .../searchPlant/SearchedPlantList.tsx | 1 - src/funnel/register/CompleteFunnel.tsx | 6 +----- src/funnel/register/LocationFunnel.tsx | 8 +------- src/funnel/register/NicknameFunnel.tsx | 7 +------ .../register/NotificationTimeFunnel.tsx | 11 ++-------- src/hooks/useNotification.tsx | 3 +-- src/pages/AddPlantPage.tsx | 3 +-- src/pages/ErrorPage.tsx | 2 +- src/pages/MyPlantEdit.tsx | 2 +- src/pages/MyPlantFeedPage.tsx | 4 ++-- 22 files changed, 41 insertions(+), 111 deletions(-) diff --git a/src/components/addPlant/NotificationToggle.tsx b/src/components/addPlant/NotificationToggle.tsx index 8e6d6a3..fdb7511 100644 --- a/src/components/addPlant/NotificationToggle.tsx +++ b/src/components/addPlant/NotificationToggle.tsx @@ -97,7 +97,6 @@ const NotificationToggle = ({ setIsOpen(false); }} text={'선택하기'} - className={'bg-BloomingGreen500 text-white'} />, ]} isOpen={isOpen} diff --git a/src/components/addPlant/NotificationToggleList.tsx b/src/components/addPlant/NotificationToggleList.tsx index 3b098eb..f382b80 100644 --- a/src/components/addPlant/NotificationToggleList.tsx +++ b/src/components/addPlant/NotificationToggleList.tsx @@ -125,13 +125,7 @@ const NotificationToggleList = ({ } - actions={[ - setBottomSheetOpen(false)} - />, - ]} + actions={[ setBottomSheetOpen(false)} />]} isOpen={bottomSheetOpen} onOpenChange={setBottomSheetOpen} /> diff --git a/src/components/addPlant/PlantLocationBadgeList.tsx b/src/components/addPlant/PlantLocationBadgeList.tsx index ce8ae9a..4dfcc88 100644 --- a/src/components/addPlant/PlantLocationBadgeList.tsx +++ b/src/components/addPlant/PlantLocationBadgeList.tsx @@ -22,8 +22,6 @@ import IconPlusMono from '@/assets/icon/plus-dark-gray.svg?react'; import LocationBadge from '@/components/addPlant/LocationBadge.tsx'; import { PlantLocation } from '@/types/plantLocation'; - -import { cn } from '@/utils.ts'; import { isFalsy } from '@/utils/validation/isFalsy.ts'; interface PlantLocationBadgeListProps { @@ -189,9 +187,6 @@ const PlantLocationBadgeList = ({ text={'등록하기'} type={'button'} onClick={addNewLocationHandler} - className={cn( - isFalsy(newLocationName) || isError ? 'bg-Gray300' : 'bg-BloomingGreen500', - )} disabled={isFalsy(newLocationName) || isError} />, ]} @@ -209,13 +204,13 @@ const PlantLocationBadgeList = ({ text={'취소'} type={'button'} onClick={closeDeleteModalHandler} - className={'bg-Gray100 text-Gray800'} + variant={'ghost'} />, deleteLocationHandler()} - className={'bg-Red500'} + variant={'warning'} />, ]} isOpen={isOpenDeleteModal} diff --git "a/src/components/addPlant/\353\247\210\354\247\200\353\247\211\354\234\274\353\241\234\353\254\274\354\244\200\353\202\240.tsx" "b/src/components/addPlant/\353\247\210\354\247\200\353\247\211\354\234\274\353\241\234\353\254\274\354\244\200\353\202\240.tsx" index e8f72c6..404ac6a 100644 --- "a/src/components/addPlant/\353\247\210\354\247\200\353\247\211\354\234\274\353\241\234\353\254\274\354\244\200\353\202\240.tsx" +++ "b/src/components/addPlant/\353\247\210\354\247\200\353\247\211\354\234\274\353\241\234\353\254\274\354\244\200\353\202\240.tsx" @@ -71,9 +71,7 @@ const 마지막으로물준날 = ({ onClick, value, type = 'simple' }: 마지막 /> ) } - actions={[ - , - ]} + actions={[]} isOpen={open} onClose={onClose} /> diff --git "a/src/components/addPlant/\353\247\210\354\247\200\353\247\211\354\234\274\353\241\234\353\271\204\353\243\214\354\244\200\353\202\240.tsx" "b/src/components/addPlant/\353\247\210\354\247\200\353\247\211\354\234\274\353\241\234\353\271\204\353\243\214\354\244\200\353\202\240.tsx" index dd9e82d..ff9ba58 100644 --- "a/src/components/addPlant/\353\247\210\354\247\200\353\247\211\354\234\274\353\241\234\353\271\204\353\243\214\354\244\200\353\202\240.tsx" +++ "b/src/components/addPlant/\353\247\210\354\247\200\353\247\211\354\234\274\353\241\234\353\271\204\353\243\214\354\244\200\353\202\240.tsx" @@ -67,13 +67,7 @@ const 마지막으로비료준날 = ({ onClick, value, type = 'simple' }: 마지 /> ) } - actions={[ - onComplete()} - />, - ]} + actions={[ onComplete()} />]} isOpen={openBottomSheet} onClose={() => setOpenBottomSheet(false)} /> diff --git "a/src/components/addPlant/\355\225\250\352\273\230\355\225\230\352\270\260\354\213\234\354\236\221\355\225\234\353\202\240.tsx" "b/src/components/addPlant/\355\225\250\352\273\230\355\225\230\352\270\260\354\213\234\354\236\221\355\225\234\353\202\240.tsx" index 5cfcaa4..c60129a 100644 --- "a/src/components/addPlant/\355\225\250\352\273\230\355\225\230\352\270\260\354\213\234\354\236\221\355\225\234\353\202\240.tsx" +++ "b/src/components/addPlant/\355\225\250\352\273\230\355\225\230\352\270\260\354\213\234\354\236\221\355\225\234\353\202\240.tsx" @@ -28,6 +28,13 @@ const 함께하기시작한날 = ({ onClick, value }: 함께하기시작한날Pr setOpen(false); }; + const handleButtonClick = () => { + onClick( + `${year}-${prefixWithZero(month)}-${prefixWithZero(day)}` as `${number}-${number}-${number}`, + ); + onClose(); + }; + return ( <> } - actions={[ - { - onClick( - `${year}-${prefixWithZero(month)}-${prefixWithZero(day)}` as `${number}-${number}-${number}`, - ); - onClose(); - }} - text={'선택하기'} - className={'bg-BloomingGreen500'} - />, - ]} + actions={[]} isOpen={open} onClose={onClose} /> diff --git a/src/components/common/CTAButton/index.tsx b/src/components/common/CTAButton/index.tsx index 8475b57..82e8d5a 100644 --- a/src/components/common/CTAButton/index.tsx +++ b/src/components/common/CTAButton/index.tsx @@ -2,24 +2,24 @@ import { Button, ButtonProps } from '@/components/ui/button.tsx'; import { cn } from '@/utils.ts'; import { ReactNode } from 'react'; -interface CTAButtonProps extends ButtonProps { - color?: keyof typeof CTAButtonColor; +interface CTAButtonProps extends Omit { text: string | ReactNode; icon?: string | ReactNode; + variant?: 'primary' | 'warning' | 'ghost'; } -const CTAButtonColor = { - disabled: 'bg-gray-400', - normal: 'bg-gray-700', - active: 'bg-gray-800', +const CTAButtonColorVariants = { + primary: 'bg-BloomingGreen500 text-white disabled:bg-Gray300', + warning: 'bg-Red500 text-white disabled:bg-Gray300', + ghost: 'bg-Gray300 text-Gray800 disabled:bg-Gray100', }; -const CTAButton = ({ text, color = 'normal', className, icon, ...rest }: CTAButtonProps) => { +const CTAButton = ({ text, className, icon, variant = 'primary', ...rest }: CTAButtonProps) => { return ( - + ); diff --git a/src/pages/MyPlantFeedPage.tsx b/src/pages/MyPlantFeedPage.tsx index 8961312..3c85dfd 100644 --- a/src/pages/MyPlantFeedPage.tsx +++ b/src/pages/MyPlantFeedPage.tsx @@ -121,18 +121,18 @@ const MyPlantFeedPage = () => { {isDeleteMode ? (
{ setIsDeleteMode(false); setSelectedImages([]); }} + variant={'ghost'} />
) : (