|
| 1 | +import React from 'react'; |
| 2 | +import { motion, AnimatePresence } from 'framer-motion'; |
| 3 | +import { XIcon } from '@phosphor-icons/react'; |
| 4 | +import GenerativeArt from './GenerativeArt'; |
| 5 | + |
| 6 | +const BrutalistDialog = ({ |
| 7 | + isOpen, |
| 8 | + onClose, |
| 9 | + onConfirm, |
| 10 | + title = 'SYSTEM_CONFIRMATION', |
| 11 | + message = 'Are you sure you want to execute this operation?', |
| 12 | + confirmText = 'CONFIRM_ACTION', |
| 13 | + cancelText = 'ABORT_OPERATION', |
| 14 | +}) => { |
| 15 | + return ( |
| 16 | + <AnimatePresence> |
| 17 | + {isOpen && ( |
| 18 | + <div className="fixed inset-0 z-[100] flex items-center justify-center p-6"> |
| 19 | + {/* Backdrop with blur */} |
| 20 | + <motion.div |
| 21 | + initial={{ opacity: 0 }} |
| 22 | + animate={{ opacity: 1 }} |
| 23 | + exit={{ opacity: 0 }} |
| 24 | + onClick={onClose} |
| 25 | + className="absolute inset-0 bg-black/80 backdrop-blur-md" |
| 26 | + /> |
| 27 | + |
| 28 | + {/* Dialog Container */} |
| 29 | + <motion.div |
| 30 | + initial={{ opacity: 0, scale: 0.9, y: 20 }} |
| 31 | + animate={{ opacity: 1, scale: 1, y: 0 }} |
| 32 | + exit={{ opacity: 0, scale: 0.9, y: 20 }} |
| 33 | + className="relative w-full max-w-lg bg-[#050505] border border-white/10 p-8 md:p-12 rounded-sm shadow-2xl overflow-hidden" |
| 34 | + onClick={(e) => e.stopPropagation()} |
| 35 | + > |
| 36 | + {/* Background Art */} |
| 37 | + <div className="absolute inset-0 opacity-[0.03] pointer-events-none grayscale"> |
| 38 | + <GenerativeArt seed={title} className="w-full h-full" /> |
| 39 | + </div> |
| 40 | + |
| 41 | + {/* Corner Accents (Lines only at corners) */} |
| 42 | + <div className="absolute top-0 left-0 w-8 h-8 border-t-2 border-l-2 border-emerald-500" /> |
| 43 | + <div className="absolute top-0 right-0 w-8 h-8 border-t-2 border-r-2 border-emerald-500" /> |
| 44 | + <div className="absolute bottom-0 left-0 w-8 h-8 border-b-2 border-l-2 border-emerald-500" /> |
| 45 | + <div className="absolute bottom-0 right-0 w-8 h-8 border-b-2 border-r-2 border-emerald-500" /> |
| 46 | + |
| 47 | + <div className="relative z-10 space-y-8"> |
| 48 | + <div className="flex justify-between items-start gap-4"> |
| 49 | + <h3 className="text-2xl font-black font-mono tracking-tighter text-white uppercase italic leading-none"> |
| 50 | + {title} |
| 51 | + </h3> |
| 52 | + <button |
| 53 | + onClick={onClose} |
| 54 | + className="p-1 text-gray-500 hover:text-white transition-colors" |
| 55 | + > |
| 56 | + <XIcon weight="bold" size={24} /> |
| 57 | + </button> |
| 58 | + </div> |
| 59 | + |
| 60 | + <div className="space-y-2"> |
| 61 | + <div className="h-px w-12 bg-emerald-500" /> |
| 62 | + <p className="text-gray-400 font-mono text-xs uppercase tracking-widest leading-relaxed"> |
| 63 | + {message} |
| 64 | + </p> |
| 65 | + </div> |
| 66 | + |
| 67 | + <div className="flex flex-col sm:flex-row gap-4 pt-4"> |
| 68 | + <button |
| 69 | + onClick={onConfirm} |
| 70 | + className="flex-1 py-4 bg-white text-black font-black uppercase tracking-[0.3em] hover:bg-emerald-400 transition-all text-xs" |
| 71 | + > |
| 72 | + {confirmText} |
| 73 | + </button> |
| 74 | + <button |
| 75 | + onClick={onClose} |
| 76 | + className="flex-1 py-4 border border-white/10 text-gray-500 hover:text-white hover:bg-white/5 transition-all font-mono text-[10px] uppercase tracking-widest" |
| 77 | + > |
| 78 | + {cancelText} |
| 79 | + </button> |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + </motion.div> |
| 83 | + </div> |
| 84 | + )} |
| 85 | + </AnimatePresence> |
| 86 | + ); |
| 87 | +}; |
| 88 | + |
| 89 | +export default BrutalistDialog; |
0 commit comments