Spaces:
Sleeping
Sleeping
Download components/ConfirmDialog.tsx from codebybrody/codebydante: direct link, hf CLI and curl.
- Browser
- Download file 2.67 kB
-
https://huggingface.co/spaces/codebybrody/codebydante/resolve/main/components/ConfirmDialog.tsx
- Command line
-
hf download hf://spaces/codebybrody/codebydante/components/ConfirmDialog.tsx
-
curl -L -o ConfirmDialog.tsx https://huggingface.co/spaces/codebybrody/codebydante/resolve/main/components/ConfirmDialog.tsx
2.67 kB
| import React from 'react'; | |
| import { AlertTriangle, X } from 'lucide-react'; | |
| interface ConfirmDialogProps { | |
| isOpen: boolean; | |
| onClose: () => void; | |
| onConfirm: () => void; | |
| title: string; | |
| message: string; | |
| confirmText?: string; | |
| cancelText?: string; | |
| variant?: 'danger' | 'warning' | 'info'; | |
| } | |
| export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({ | |
| isOpen, | |
| onClose, | |
| onConfirm, | |
| title, | |
| message, | |
| confirmText = 'Confirmar', | |
| cancelText = 'Cancelar', | |
| variant = 'danger' | |
| }) => { | |
| if (!isOpen) return null; | |
| return ( | |
| <div className="fixed inset-0 z-[100] flex items-center justify-center bg-black/60 backdrop-blur-sm animate-fade-in"> | |
| <div className="bg-[#1a1a1a] border border-white/10 rounded-xl shadow-2xl w-[400px] max-w-[90vw] overflow-hidden animate-in zoom-in-95 duration-200"> | |
| <div className="p-6"> | |
| <div className="flex items-start gap-4"> | |
| <div className={`p-3 rounded-full ${variant === 'danger' ? 'bg-red-500/10 text-red-500' : 'bg-yellow-500/10 text-yellow-500'}`}> | |
| <AlertTriangle size={24} /> | |
| </div> | |
| <div className="flex-1"> | |
| <h3 className="text-lg font-bold text-white mb-2">{title}</h3> | |
| <p className="text-gray-400 text-sm leading-relaxed">{message}</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div className="bg-white/5 px-6 py-4 flex justify-end gap-3 border-t border-white/5"> | |
| <button | |
| onClick={onClose} | |
| className="px-4 py-2 rounded-lg text-sm font-medium text-gray-400 hover:text-white hover:bg-white/5 transition-colors" | |
| > | |
| {cancelText} | |
| </button> | |
| <button | |
| onClick={() => { | |
| onConfirm(); | |
| onClose(); | |
| }} | |
| className={`px-4 py-2 rounded-lg text-sm font-medium text-white transition-colors shadow-lg ${variant === 'danger' | |
| ? 'bg-red-500 hover:bg-red-600 shadow-red-500/20' | |
| : 'bg-yellow-500 hover:bg-yellow-600 shadow-yellow-500/20' | |
| }`} | |
| > | |
| {confirmText} | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| }; | |