diff --git a/src/app/(sidebar)/(my-info)/components/AddInfoCardDialog.tsx b/src/app/(sidebar)/(my-info)/components/AddInfoCardDialog.tsx index b8f1b0c..acc3927 100644 --- a/src/app/(sidebar)/(my-info)/components/AddInfoCardDialog.tsx +++ b/src/app/(sidebar)/(my-info)/components/AddInfoCardDialog.tsx @@ -1,7 +1,7 @@ import { Icon } from '@/system/components'; import { Dialog, DialogClose, DialogContent, DialogTitle, DialogTrigger } from '@/system/components/Dialog/Dialog'; import { TagType, InfoType, INFO_TYPES } from '@/types/info'; -import { PropsWithChildren, useState } from 'react'; +import { PropsWithChildren, useEffect, useState } from 'react'; import { TagSelector } from '../../write/[id]/components/TagSelector/TagSelector'; import { If } from '@/system/utils/If'; import { cn } from '@/utils/tailwind-util'; @@ -12,11 +12,14 @@ import { TouchButton } from '@/components/TouchButton'; import { useRouter } from 'next/navigation'; import { motion } from 'framer-motion'; -export function AddInfoCardDialog({ children }: PropsWithChildren) { +export function AddInfoCardDialog({ + children, + currentCardType = '경험_정리', +}: PropsWithChildren<{ currentCardType?: InfoType }>) { const router = useRouter(); const [selectedTagList, setSelectedTagList] = useState([]); - const [selectedType, setSelectedType] = useState(null); + const [selectedType, setSelectedType] = useState(currentCardType || null); const [isOpenTagSelector, setIsOpenTagSelector] = useState(false); const [isOpenTypeSelector, setIsOpenTypeSelector] = useState(false); @@ -38,6 +41,10 @@ export function AddInfoCardDialog({ children }: PropsWithChildren) { router.push(`/write/${res.cardId}`); }; + useEffect(() => { + setSelectedType(currentCardType); + }, [currentCardType]); + return ( { @@ -102,7 +109,7 @@ export function AddInfoCardDialog({ children }: PropsWithChildren) { {abilityTagList.map((tag) => ( { if (selectedTagList.length < 3 && !selectedTagList.find(({ id }) => id === tag.id)) { setSelectedTagList((prev) => [...prev, tag]); @@ -119,7 +126,7 @@ export function AddInfoCardDialog({ children }: PropsWithChildren) { {personalityTagList.map((tag) => ( { if (selectedTagList.length < 3 && !selectedTagList.find(({ id }) => id === tag.id)) { setSelectedTagList((prev) => [...prev, tag]); diff --git a/src/app/(sidebar)/(my-info)/page.tsx b/src/app/(sidebar)/(my-info)/page.tsx index dc776a7..b890262 100644 --- a/src/app/(sidebar)/(my-info)/page.tsx +++ b/src/app/(sidebar)/(my-info)/page.tsx @@ -109,7 +109,7 @@ export default function MyInfo() { ))} - +
-
+
' -

{memo}

+

{memo}

'

메모를 정말 삭제하시겠습니까?