| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 'use client';
- import { AlertCircle } from 'lucide-react';
- import { useLanguage } from '@/lib/i18n/LanguageContext';
- interface MessageModalProps {
- isOpen: boolean;
- title?: string;
- message: string;
- onClose: () => void;
- type?: 'info' | 'error' | 'success';
- }
- export default function MessageModal({ isOpen, onClose, message, title, type = 'error' }: MessageModalProps) {
- const { t } = useLanguage();
- if (!isOpen) return null;
- return (
- <div className="fixed inset-0 z-[60] flex items-center justify-center bg-black/60 backdrop-grayscale p-4 animate-in fade-in duration-200">
- <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-sm flex flex-col font-mono overflow-hidden">
- {/* Header */}
- <div className="px-4 py-3 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black">
- <div className="font-bold text-xs flex items-center gap-2 uppercase tracking-wider">
- <span className={`w-2.5 h-2.5 inline-block border border-black ${type === 'error' ? 'bg-rose-500' : 'bg-amber-300'}`} />
- <span>[ {title || t('common.notice') || 'NOTICE'} ]</span>
- </div>
- <button aria-label={t('common.close')}
- onClick={onClose}
- className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-bold text-xs transition"
- >
- ✕
- </button>
- </div>
- {/* Body */}
- <div className="p-6 bg-white">
- <p className="text-xs sm:text-sm text-neutral-800 leading-relaxed text-center font-sans">
- {message}
- </p>
- </div>
- {/* Footer */}
- <div className="px-4 py-3 border-t-2 border-black bg-neutral-100 flex justify-center font-mono">
- <button
- onClick={onClose}
- className="w-full bg-amber-300 hover:bg-amber-400 text-black py-2.5 border-2 border-black font-black text-xs transition shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 active:shadow-none uppercase"
- >
- [ {t('common.confirm_known') || '知道了 // OK'} ]
- </button>
- </div>
- </div>
- </div>
- );
- }
|