Spaces:
Running
Running
| @if (IsVisible) | |
| { | |
| <div class="fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm"> | |
| <div class="w-full max-w-sm mx-4 overflow-hidden rounded-lg border border-slate-100 bg-white shadow-lg animate-in"> | |
| <div class="p-6 text-center"> | |
| <div class="mx-auto flex h-14 w-14 items-center justify-center rounded-full mb-4" style="background-color: @GetIconBg(); color: @GetIconColor();"> | |
| <i data-lucide="@Icon" class="h-7 w-7"></i> | |
| </div> | |
| <h3 class="text-lg font-semibold" style="color: var(--text-primary);">@Title</h3> | |
| <p class="text-sm mt-2" style="color: var(--text-muted);">@Message</p> | |
| </div> | |
| <div class="flex items-center justify-center space-x-3 px-6 py-4 border-t border-slate-100 bg-slate-50/50"> | |
| @if (!HideCancel) | |
| { | |
| <button @onclick="OnCancel" class="flex-1 rounded-lg px-4 py-2.5 text-sm font-medium transition-colors border border-slate-200 bg-white hover:bg-slate-50" style="color: var(--text-muted);"> | |
| @AppLocalization.Text("common.cancel", "Cancel") | |
| </button> | |
| } | |
| <button @onclick="OnConfirm" class="flex-1 rounded-lg px-4 py-2.5 text-sm font-medium text-white transition-colors @ButtonClass" style="@ConfirmButtonStyle"> | |
| @ConfirmText | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| } | |
| @code { | |
| [] public bool IsVisible { get; set; } | |
| [] public string Title { get; set; } = AppLocalization.Text("common.areYouSure", "Are you sure?"); | |
| [] public string Message { get; set; } = AppLocalization.Text("common.cannotUndo", "This action cannot be undone."); | |
| [] public string ConfirmText { get; set; } = AppLocalization.Text("common.confirmAction", "Confirm"); | |
| [] public string Icon { get; set; } = "alert-triangle"; | |
| [] public string IconBgClass { get; set; } = ""; | |
| [] public string IconTextClass { get; set; } = ""; | |
| [] public string ButtonClass { get; set; } = ""; | |
| [] public bool HideCancel { get; set; } | |
| [] public EventCallback OnConfirm { get; set; } | |
| [] public EventCallback OnCancel { get; set; } | |
| private string ConfirmButtonStyle => string.IsNullOrWhiteSpace(ButtonClass) | |
| ? $"background-color: {GetButtonBg()};" | |
| : string.Empty; | |
| private string GetIconBg() | |
| { | |
| if (Icon.Contains("trash") || Icon.Contains("alert")) | |
| return "var(--status-danger-bg)"; | |
| return "var(--status-success-bg)"; | |
| } | |
| private string GetIconColor() | |
| { | |
| if (Icon.Contains("trash") || Icon.Contains("alert")) | |
| return "var(--status-danger-text)"; | |
| return "var(--brand-primary)"; | |
| } | |
| private string GetButtonBg() | |
| { | |
| if (Icon.Contains("trash") || Icon.Contains("alert")) | |
| return "var(--status-danger-text)"; | |
| return "var(--brand-primary)"; | |
| } | |
| } | |