This commit is contained in:
2025-12-17 19:50:55 +07:00
parent debdd66458
commit 7e7cdbcd76
10 changed files with 225 additions and 77 deletions

View File

@@ -2,7 +2,7 @@ import { useEffect } from 'react'
import { AlertTriangle, Info, Trash2, X } from 'lucide-react'
import { clsx } from 'clsx'
import { useConfirmStore, type ConfirmVariant } from '@/store/confirm'
import { Button } from './Button'
import { NeonButton } from './NeonButton'
const icons: Record<ConfirmVariant, React.ReactNode> = {
danger: <Trash2 className="w-6 h-6" />,
@@ -11,15 +11,15 @@ const icons: Record<ConfirmVariant, React.ReactNode> = {
}
const iconStyles: Record<ConfirmVariant, string> = {
danger: 'bg-red-500/20 text-red-500',
warning: 'bg-yellow-500/20 text-yellow-500',
info: 'bg-blue-500/20 text-blue-500',
danger: 'bg-red-500/10 text-red-400 border border-red-500/30',
warning: 'bg-yellow-500/10 text-yellow-400 border border-yellow-500/30',
info: 'bg-neon-500/10 text-neon-400 border border-neon-500/30',
}
const buttonVariants: Record<ConfirmVariant, 'danger' | 'primary' | 'secondary'> = {
danger: 'danger',
warning: 'primary',
info: 'primary',
const confirmButtonStyles: Record<ConfirmVariant, string> = {
danger: 'border-red-500/50 text-red-400 hover:bg-red-500/10 hover:border-red-500',
warning: 'border-yellow-500/50 text-yellow-400 hover:bg-yellow-500/10 hover:border-yellow-500',
info: '', // Will use NeonButton default
}
export function ConfirmModal() {
@@ -62,7 +62,7 @@ export function ConfirmModal() {
/>
{/* Modal */}
<div className="relative bg-gray-800 rounded-xl shadow-2xl max-w-md w-full animate-in zoom-in-95 fade-in duration-200 border border-gray-700">
<div className="relative glass rounded-xl shadow-2xl max-w-md w-full animate-in zoom-in-95 fade-in duration-200 border border-dark-600">
{/* Close button */}
<button
onClick={handleCancel}
@@ -89,20 +89,31 @@ export function ConfirmModal() {
{/* Actions */}
<div className="flex gap-3">
<Button
<NeonButton
variant="secondary"
className="flex-1"
onClick={handleCancel}
>
{options.cancelText || 'Отмена'}
</Button>
<Button
variant={buttonVariants[variant]}
className="flex-1"
onClick={handleConfirm}
>
{options.confirmText || 'Подтвердить'}
</Button>
</NeonButton>
{variant === 'info' ? (
<NeonButton
className="flex-1"
onClick={handleConfirm}
>
{options.confirmText || 'Подтвердить'}
</NeonButton>
) : (
<button
className={clsx(
'flex-1 px-4 py-2.5 rounded-lg font-semibold transition-all duration-200 border-2 bg-transparent',
confirmButtonStyles[variant]
)}
onClick={handleConfirm}
>
{options.confirmText || 'Подтвердить'}
</button>
)}
</div>
</div>
</div>