54 lines
2.2 KiB
Plaintext
54 lines
2.2 KiB
Plaintext
@namespace MidrandBooks.Components
|
|
@using Microsoft.AspNetCore.Components
|
|
|
|
<div id="error-razor" class="w-full max-w-xl mx-auto px-4 py-16 text-center space-y-6">
|
|
<div class="mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-500/10 text-red-600 border border-red-500/20">
|
|
<svg class="h-8 w-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
|
</svg>
|
|
</div>
|
|
|
|
<div class="space-y-2">
|
|
<h2 class="font-serif text-2xl md:text-3xl font-bold text-slate-800">Something went wrong</h2>
|
|
<p class="text-xs text-slate-500 max-w-sm mx-auto leading-relaxed">
|
|
@Message
|
|
</p>
|
|
</div>
|
|
|
|
@if (!string.IsNullOrEmpty(ErrorCode))
|
|
{
|
|
<div class="p-3 bg-slate-50 rounded-xl border border-slate-100 inline-block font-mono text-[10px] text-slate-400">
|
|
Error Code: <span class="font-bold text-slate-600">@ErrorCode</span>
|
|
</div>
|
|
}
|
|
|
|
<div class="flex justify-center gap-3 pt-2">
|
|
@if (OnRetry.HasDelegate)
|
|
{
|
|
<button @onclick="HandleRetry" class="px-5 py-2 rounded-xl bg-violet-600 hover:bg-violet-500 text-white font-bold text-xs transition-all shadow-md shadow-violet-500/15 cursor-pointer">
|
|
Try Again
|
|
</button>
|
|
}
|
|
<button @onclick="HandleBackToHome" class="px-5 py-2 rounded-xl border border-slate-200 hover:bg-slate-50 text-slate-600 font-bold text-xs transition-all cursor-pointer">
|
|
Back to Catalog
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter] public string Message { get; set; } = "An unexpected error occurred while processing your request. Please try again later.";
|
|
[Parameter] public string? ErrorCode { get; set; } = "ERR_CONNECTION_FAILED";
|
|
[Parameter] public EventCallback OnRetry { get; set; }
|
|
[Parameter] public EventCallback OnBackToHome { get; set; }
|
|
|
|
private async Task HandleRetry()
|
|
{
|
|
await OnRetry.InvokeAsync();
|
|
}
|
|
|
|
private async Task HandleBackToHome()
|
|
{
|
|
await OnBackToHome.InvokeAsync();
|
|
}
|
|
}
|