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} + + + + + 확인 + + + + + + ); +}