diff --git a/src/components/home/OfficeNotice.tsx b/src/components/home/OfficeNotice.tsx index e1561bb..fc5b2b6 100644 --- a/src/components/home/OfficeNotice.tsx +++ b/src/components/home/OfficeNotice.tsx @@ -1,26 +1,48 @@ -import React from 'react'; +import React, { useState } from 'react'; import { useNotices } from '@/hook/useNotices'; const OfficeNotice: React.FC = () => { - - const { urgentNoticeTitle } = useNotices(); + const { urgentNoticeTitle, urgentNoticeContent } = useNotices(); + const [isModalOpen, setIsModalOpen] = useState(false); -return ( -
-
- -
+ const handleModalOpen = () => { + setIsModalOpen(true); + }; -
-
- {urgentNoticeTitle ? urgentNoticeTitle : '긴급 공지가 없습니다.'} -
-
- + const handleModalClose = () => { + setIsModalOpen(false); + }; + + return ( + <> +
+
+ +
+ +
+
+ {urgentNoticeTitle ? urgentNoticeTitle : '긴급 공지가 없습니다.'} +
+ {urgentNoticeContent && ( +
+ +
+ )} +
-
-
-); + {isModalOpen && ( +
+
+
+

긴급 공지

+

{urgentNoticeContent}

+ +
+
+ )} + + ); }; export default OfficeNotice; diff --git a/src/hook/useNotices.ts b/src/hook/useNotices.ts index 76cccb2..b355cce 100644 --- a/src/hook/useNotices.ts +++ b/src/hook/useNotices.ts @@ -21,6 +21,7 @@ const seededRandom = (seed: number) => { export const useNotices = () => { const [randomNotices, setRandomNotices] = useState([]); const [urgentNoticeTitle, setUrgentNoticeTitle] = useState(null); + const [urgentNoticeContent, setUrgentNoticeContent] = useState(null); const [expandedNotice, setExpandedNotice] = useState<{ [key: string]: boolean }>({}); const [currentDate, setCurrentDate] = useState(''); const selectedBranch = useBranchStore((state) => state.selectedBranch); @@ -50,6 +51,7 @@ export const useNotices = () => { setRandomNotices(combinedNotices); setUrgentNoticeTitle(randomUrgentNotice ? randomUrgentNotice.title : null); + setUrgentNoticeContent(randomUrgentNotice ? randomUrgentNotice.content : null); }, [selectedBranch]); @@ -60,5 +62,5 @@ export const useNotices = () => { })); }; - return { randomNotices, urgentNoticeTitle, expandedNotice, toggleExpand, currentDate }; + return { randomNotices, urgentNoticeTitle, urgentNoticeContent, expandedNotice, toggleExpand, currentDate }; };