<MudDialog OnBackdropClick="Cancel">
    <DialogContent>
        @if (IsWarning)
        {
            <div class="exception-header mb-2">
                <i class="ri-error-warning-line warning-icon"></i>
                <span>Attenzione</span>
            </div>
        }
        else
        {
            <div class="exception-header mb-2">
                <i class="ri-emotion-unhappy-line error-icon"></i>
                <span>Ops</span>
            </div>
        }
        <div class="text">
            <code>@ErrorMessage</code>
        </div>
    </DialogContent>
    <DialogActions>
        <MudButton Variant="Variant.Text" OnClick="@Cancel" Size="Size.Small" Color="Color.Primary">
            Chiudi
        </MudButton>
    </DialogActions>
</MudDialog>

@code {
    [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
    [Parameter] public string ErrorMessage { get; set; } = string.Empty;
    [Parameter] public bool IsWarning { get; set; }

    private void Cancel() => MudDialog.Cancel();
}