'use client' import { useState } from 'react' import { Check, X } from 'lucide-react' import { Alert } from '@/lib/types' import { cn } from '@/lib/utils' import { AlertIcon } from './AlertIcon' interface AlertBannerProps { alert: Alert onDismiss: () => void onMarkRead: () => void } const severityStyles = { info: { bg: 'bg-blue-900/50', border: 'border-l-blue-500', icon: 'text-blue-400', }, warning: { bg: 'bg-amber-900/50', border: 'border-l-amber-500', icon: 'text-amber-400', }, danger: { bg: 'bg-red-900/50', border: 'border-l-red-500', icon: 'text-red-400', }, } export function AlertBanner({ alert, onDismiss, onMarkRead }: AlertBannerProps) { const [isVisible, setIsVisible] = useState(true) const [isExiting, setIsExiting] = useState(false) const styles = severityStyles[alert.severity] const handleDismiss = () => { setIsExiting(true) setTimeout(() => { setIsVisible(false) onDismiss() }, 300) } const handleMarkRead = () => { setIsExiting(true) setTimeout(() => { setIsVisible(false) onMarkRead() }, 300) } if (!isVisible) { return null } return (
{alert.message}