import React from 'react'; import { BellRing, X, Check } from 'lucide-react'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; import { toast } from 'sonner'; // 알림 타입 정의 export interface Notification { id: string; title: string; message: string; timestamp: Date; read: boolean; } interface NotificationPopoverProps { notifications: Notification[]; onClearAll: () => void; onReadNotification: (id: string) => void; } const NotificationPopover: React.FC = ({ notifications, onClearAll, onReadNotification }) => { const unreadCount = notifications.filter(notification => !notification.read).length; const handleClearAll = () => { onClearAll(); toast.success('모든 알림이 삭제되었습니다.'); }; const formatDate = (date: Date) => { return new Intl.DateTimeFormat('ko-KR', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }).format(date); }; return (

알림

{unreadCount > 0 && ( {unreadCount} )}
{notifications.length > 0 && ( )}
{notifications.length === 0 ? (
알림이 없습니다.
) : ( notifications.map((notification) => (

{notification.title}

{notification.message}

{formatDate(notification.timestamp)}

)) )}
); }; export default NotificationPopover;