From 5a4982f02fb5199e7640f83b70fa17dca80be227 Mon Sep 17 00:00:00 2001 From: westofsky Date: Mon, 27 Oct 2025 06:43:25 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EA=B8=B0=EC=83=81=EC=B2=AD=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EB=B6=88=EC=95=88=EC=A0=95=20dialog=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(pages)/weather/page.tsx | 6 +++ src/components/notice-dialog.tsx | 72 ++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/components/notice-dialog.tsx diff --git a/src/app/(pages)/weather/page.tsx b/src/app/(pages)/weather/page.tsx index ea6b96c..cb8e66e 100644 --- a/src/app/(pages)/weather/page.tsx +++ b/src/app/(pages)/weather/page.tsx @@ -1,10 +1,16 @@ import { WeatherLocationTab } from './_components/weather-locaion-tab'; import { Suspense } from 'react'; import { WeatherSection } from './_components/weather-section'; +import { NoticeDialog } from '@/components/notice-dialog'; export default function WeatherPage() { return (
+
날씨
diff --git a/src/components/notice-dialog.tsx b/src/components/notice-dialog.tsx new file mode 100644 index 0000000..c52320f --- /dev/null +++ b/src/components/notice-dialog.tsx @@ -0,0 +1,72 @@ +'use client'; + +import { useState, useEffect } from 'react'; +import { + AlertDialog, + AlertDialogAction, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from '@/components/ui/alert-dialog'; + +interface NoticeDialogProps { + title: string; + description: string; + storageKey?: string; +} + +export function NoticeDialog({ + title, + description, + storageKey = 'notice-dismissed', +}: NoticeDialogProps) { + const [open, setOpen] = useState(false); + + useEffect(() => { + const dismissedDate = localStorage.getItem(storageKey); + const today = new Date().toDateString(); + + if (dismissedDate !== today) { + setOpen(true); + } + }, [storageKey]); + + const handleDismissToday = () => { + const today = new Date().toDateString(); + localStorage.setItem(storageKey, today); + setOpen(false); + }; + + const handleClose = () => { + setOpen(false); + }; + + return ( + + + + {title} + + {description} + + + + + 확인 + + + + + + ); +}