| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 'use client';
- import { X } from 'lucide-react';
- interface ConfirmModalProps {
- isOpen: boolean;
- title: string;
- message: string;
- onConfirm: () => void;
- onCancel: () => void;
- }
- export default function ConfirmModal({ isOpen, onCancel, onConfirm, message, title }: ConfirmModalProps) {
- if (!isOpen) return null;
- return (
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-4">
- <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-md flex flex-col font-mono animate-in zoom-in-95 duration-200">
-
- {/* Header */}
- <div className="px-5 py-3 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black">
- <div className="flex items-center gap-2 text-xs font-bold uppercase tracking-wider">
- <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
- <span>[ {title} ]</span>
- </div>
- <button
- onClick={onCancel}
- 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 font-sans text-center">
- {message}
- </p>
- </div>
- {/* Footer Buttons */}
- <div className="px-5 py-4 border-t-2 border-black bg-neutral-100 flex justify-end gap-3 font-mono">
- <button
- onClick={onCancel}
- className="px-4 py-2 border-2 border-black bg-white text-black font-bold text-xs shadow-[2px_2px_0px_#000] hover:bg-neutral-50 transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none"
- >
- [ 取消 ]
- </button>
- <button
- onClick={() => {
- onConfirm();
- onCancel();
- }}
- className="px-6 py-2 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none"
- >
- [ 确认提交 → ]
- </button>
- </div>
- </div>
- </div>
- );
- }
|