From 6888c181edaea9b66bb3eda774c940740aa8d7ff Mon Sep 17 00:00:00 2001 From: jiohjung98 Date: Fri, 31 May 2024 16:36:06 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=A7=80=EC=A0=90=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=8B=9C,=20=EC=A7=80=EC=A0=90=EB=AA=85=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/home/CurrentOffice.tsx | 16 ++++++++++++++-- src/components/home/SearchModal.tsx | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/home/CurrentOffice.tsx b/src/components/home/CurrentOffice.tsx index 87d5c75..b6fd49d 100644 --- a/src/components/home/CurrentOffice.tsx +++ b/src/components/home/CurrentOffice.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import SearchModal from './SearchModal'; import SelectOfficeMap from './SelectOfficeMap'; import { Branch } from '@/api/types/branch'; @@ -6,18 +6,28 @@ import { useBranchStore } from '@/store/branch.store'; const CurrentOffice = () => { const [showSearchModal, setShowSearchModal] = useState(false); + const [showSelectOfficeMap, setShowSelectOfficeMap] = useState(false); const selectedBranch = useBranchStore((state) => state.selectedBranch); const setSelectedBranch = useBranchStore((state) => state.setSelectedBranch); const handleBranchSelect = (branch: Branch) => { setSelectedBranch(branch); setShowSearchModal(false); + setShowSelectOfficeMap(true); }; const handleSearchClick = () => { setShowSearchModal(true); }; + const handleCloseSelectOfficeMap = () => { + setShowSelectOfficeMap(false); + }; + + useEffect(() => { + console.log('Selected Branch Updated:', selectedBranch); + }, [selectedBranch]); + return ( <>
@@ -32,7 +42,9 @@ const CurrentOffice = () => {
{showSearchModal && setShowSearchModal(false)} onBranchSelect={handleBranchSelect} />} - {selectedBranch && setSelectedBranch(null)} />} + {showSelectOfficeMap && selectedBranch && ( + + )} ); }; diff --git a/src/components/home/SearchModal.tsx b/src/components/home/SearchModal.tsx index 2fd08b6..eb42759 100644 --- a/src/components/home/SearchModal.tsx +++ b/src/components/home/SearchModal.tsx @@ -34,7 +34,7 @@ const SearchModal: React.FC = ({ onClose, onBranchSelect }) => const handleItemClick = (branch: Branch) => { setSelectedBranch(branch); - onBranchSelect(branch); + onBranchSelect(branch); }; return (