mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
<div @onkeydown="@OnKeyDown"> |
|
<MudDialog> |
|
<DialogContent> |
|
<MudContainer Class="mb-6"> |
|
<MudHighlighter Class="mud-primary-text" |
|
Style="background-color: transparent; font-weight: bold" |
|
Text="@FormatText()" |
|
HighlightedText="@EntityName"/> |
|
</MudContainer> |
|
</DialogContent> |
|
<DialogActions> |
|
<MudButton OnClick="Cancel">Cancel</MudButton> |
|
<MudButton Color="Color.Error" Variant="Variant.Filled" OnClick="Submit"> |
|
Delete From Database |
|
</MudButton> |
|
</DialogActions> |
|
</MudDialog> |
|
</div> |
|
|
|
@code { |
|
|
|
[CascadingParameter] |
|
IMudDialogInstance MudDialog { get; set; } |
|
|
|
[Parameter] |
|
public string EntityType { get; set; } |
|
|
|
[Parameter] |
|
public string EntityName { get; set; } |
|
|
|
[Parameter] |
|
public string DetailText { get; set; } |
|
|
|
[Parameter] |
|
public string DetailHighlight { get; set; } |
|
|
|
private string FormatText() => $"Do you really want to delete the {EntityType} {EntityName} from the database?"; |
|
|
|
private void Submit() => MudDialog.Close(DialogResult.Ok(true)); |
|
|
|
private void Cancel() => MudDialog.Cancel(); |
|
|
|
private void OnKeyDown(KeyboardEventArgs e) |
|
{ |
|
if (e.Code is "Enter" or "NumpadEnter") |
|
{ |
|
Submit(); |
|
} |
|
} |
|
|
|
} |