diff --git a/apps/client/src/pages/dashboard/dashboard.tsx b/apps/client/src/pages/dashboard/dashboard.tsx index 9aa1501..9586ee6 100644 --- a/apps/client/src/pages/dashboard/dashboard.tsx +++ b/apps/client/src/pages/dashboard/dashboard.tsx @@ -1,6 +1,5 @@ import { POP_UP_AREA_Z_INDEX } from '@/constants'; import ModalPop from '@/shared/components/ui/modalPop/ModalPop'; -import { Header } from '@shared/components'; import { BannerSection, BookmarkSection, @@ -8,6 +7,7 @@ import { } from '@pages/dashboard/components'; import { useDashboard } from '@pages/dashboard/hooks/useDashboard'; import type { Category } from '@pages/dashboard/types/api'; +import { Header } from '@shared/components'; import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; @@ -103,7 +103,7 @@ const Dashboard = () => {
{isPopUpOpen && (
setIsPopUpOpen(false)} >
e.stopPropagation()}> diff --git a/apps/client/src/shared/components/ui/layout/Header.tsx b/apps/client/src/shared/components/ui/layout/Header.tsx index 6858df7..f5e317e 100644 --- a/apps/client/src/shared/components/ui/layout/Header.tsx +++ b/apps/client/src/shared/components/ui/layout/Header.tsx @@ -2,7 +2,7 @@ import logo from '@assets/brand/logo.svg'; const Header = () => { return ( -
+
로고
); diff --git a/apps/client/src/shared/components/ui/modalPop/ModalPop.tsx b/apps/client/src/shared/components/ui/modalPop/ModalPop.tsx index 49476d4..cd116e6 100644 --- a/apps/client/src/shared/components/ui/modalPop/ModalPop.tsx +++ b/apps/client/src/shared/components/ui/modalPop/ModalPop.tsx @@ -1,13 +1,14 @@ -import { useState } from 'react'; +import { POP_TEXTAREA_MAX_LENGTH } from '@constants/index'; import { CategoryDropDown, CommonBtn, InfoBox, TextArea, + TextFieldPopup, TimePicker, ToggleButton, } from '@pinback/design-system/ui'; -import { POP_TEXTAREA_MAX_LENGTH } from '@constants/index'; +import { useState } from 'react'; interface ModalPopProps { onClose: () => void; } @@ -18,6 +19,12 @@ const ModalPop = ({ onClose }: ModalPopProps) => { time: '', timeError: '', }); + const [categoryPopupMode, setCategoryPopupMode] = useState< + 'edit' | 'add' | '' + >(''); + const [selectedCategory, setSelectedCategory] = useState(''); + const [categories, setCategories] = useState(['기획', '취미', '요리']); + const handleFieldChange = ( field: 'date' | 'time', value: string, @@ -30,8 +37,39 @@ const ModalPop = ({ onClose }: ModalPopProps) => { })); }; + const handleCategoryChange = (value: string) => { + if (value === 'edit') { + setCategoryPopupMode('edit'); + } else if (value === 'create') { + setCategoryPopupMode('add'); + } else { + setSelectedCategory(value); + setCategoryPopupMode(''); + } + }; + + const handlePopupClose = () => { + setCategoryPopupMode(''); + }; + + const handlePopupConfirm = (newCategory?: string) => { + if (!newCategory) { + return; + } + if (categoryPopupMode === 'add') { + setCategories((prev) => [...prev, newCategory]); + setSelectedCategory(newCategory); + } else if (categoryPopupMode === 'edit') { + setCategories((prev) => + prev.map((cat) => (cat === selectedCategory ? newCategory : cat)) + ); + setSelectedCategory(newCategory); + } + handlePopupClose(); + }; + return ( -
+
{/* TODO : 하드코딩 데이터 구간 */} {
@@ -95,6 +134,23 @@ const ModalPop = ({ onClose }: ModalPopProps) => { />
{/* TODO : 하드코딩 데이터 구간 */} + + {categoryPopupMode && ( + { + setCategories((prev) => + prev.filter((cat) => cat !== selectedCategory) + ); + setSelectedCategory(''); + handlePopupClose(); + }} + /> + )}
); }; diff --git a/apps/extension/src/components/modalPop/ModalPop.tsx b/apps/extension/src/components/modalPop/ModalPop.tsx index d766d21..cd49799 100644 --- a/apps/extension/src/components/modalPop/ModalPop.tsx +++ b/apps/extension/src/components/modalPop/ModalPop.tsx @@ -1,15 +1,15 @@ -import { useState } from 'react'; +import { POP_TEXTAREA_MAX_LENGTH } from '@constants/index'; import { CategoryDropDown, CommonBtn, InfoBox, TextArea, + TextFieldPopup, TimePicker, ToggleButton, } from '@pinback/design-system/ui'; +import { useState } from 'react'; import ModalHeader from './ModalHeader'; -import { POP_TEXTAREA_MAX_LENGTH } from '@constants/index'; -import { TextFieldPopup } from '@pinback/design-system/ui'; interface ModalPopProps { urlInfo: string; diff --git a/packages/design-system/src/components/InfoBox/InfoBox.tsx b/packages/design-system/src/components/InfoBox/InfoBox.tsx index ff7544f..cf1305a 100644 --- a/packages/design-system/src/components/InfoBox/InfoBox.tsx +++ b/packages/design-system/src/components/InfoBox/InfoBox.tsx @@ -18,11 +18,13 @@ const InfoBox = ({ size = 'large', title, location, icon }: InfoBoxProps) => { src={icon} />
-
+
{location}
{title}
diff --git a/packages/design-system/src/components/textfieldPopup/TextfieldPopup.tsx b/packages/design-system/src/components/textfieldPopup/TextfieldPopup.tsx index 5f763f9..63b179f 100644 --- a/packages/design-system/src/components/textfieldPopup/TextfieldPopup.tsx +++ b/packages/design-system/src/components/textfieldPopup/TextfieldPopup.tsx @@ -1,7 +1,6 @@ -import { useRef, useState } from 'react'; import { Icon } from '@pinback/design-system/icons'; -import { CommonBtn } from '@pinback/design-system/ui'; -import { Input } from '@pinback/design-system/ui'; +import { CommonBtn, Input } from '@pinback/design-system/ui'; +import { useRef, useState } from 'react'; type Mode = 'add' | 'edit' | 'delete'; @@ -159,7 +158,7 @@ const TextfieldPopup = ({ }; return ( -
+
{renderContent()}