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.
58 lines
1.8 KiB
58 lines
1.8 KiB
<div @onkeydown="@OnKeyDown"> |
|
<MudDialog> |
|
<DialogContent> |
|
<MudContainer> |
|
<MudHighlighter Class="mud-primary-text" |
|
Style="background-color: transparent; font-weight: bold" |
|
Text="@FormatText()" |
|
HighlightedText="@EntityName"/> |
|
</MudContainer> |
|
@if (!string.IsNullOrWhiteSpace(DetailText)) |
|
{ |
|
<MudContainer Class="mt-3"> |
|
<MudHighlighter Class="mud-primary-text" |
|
Style="background-color: transparent; font-weight: bold" |
|
Text="@DetailText" |
|
HighlightedText="@DetailHighlight"/> |
|
</MudContainer> |
|
} |
|
</DialogContent> |
|
<DialogActions> |
|
<MudButton OnClick="Cancel">Cancel</MudButton> |
|
<MudButton Color="Color.Error" Variant="Variant.Filled" OnClick="Submit">Delete</MudButton> |
|
</DialogActions> |
|
</MudDialog> |
|
</div> |
|
|
|
@code { |
|
|
|
[CascadingParameter] |
|
MudDialogInstance 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}? This process cannot be undone."; |
|
|
|
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(); |
|
} |
|
} |
|
|
|
} |