Spaces:
Running
Running
File size: 3,112 Bytes
3418204 f6d34ff 3418204 9cf881e 8c88a89 9cf881e f6d34ff 3418204 8c88a89 3418204 9cf881e 3418204 f6d34ff 3418204 f6d34ff 3418204 f6d34ff 3418204 f6d34ff 3418204 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | @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 {
[Parameter] public bool IsVisible { get; set; }
[Parameter] public string Title { get; set; } = AppLocalization.Text("common.areYouSure", "Are you sure?");
[Parameter] public string Message { get; set; } = AppLocalization.Text("common.cannotUndo", "This action cannot be undone.");
[Parameter] public string ConfirmText { get; set; } = AppLocalization.Text("common.confirmAction", "Confirm");
[Parameter] public string Icon { get; set; } = "alert-triangle";
[Parameter] public string IconBgClass { get; set; } = "";
[Parameter] public string IconTextClass { get; set; } = "";
[Parameter] public string ButtonClass { get; set; } = "";
[Parameter] public bool HideCancel { get; set; }
[Parameter] public EventCallback OnConfirm { get; set; }
[Parameter] 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)";
}
}
|