refactor(app): extract dialog component logic to code-behind
This commit is contained in:
42
src/Duempelkas.App/Components/Dialogs/ConfirmDialog.razor.cs
Normal file
42
src/Duempelkas.App/Components/Dialogs/ConfirmDialog.razor.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Duempelkas.App.Components.Dialogs;
|
||||
|
||||
public partial class ConfirmDialog
|
||||
{
|
||||
#region Parameters
|
||||
|
||||
[Parameter]
|
||||
public string Title { get; set; } = "Bestätigung";
|
||||
|
||||
[Parameter]
|
||||
public string Message { get; set; } = "Sind Sie sicher?";
|
||||
|
||||
[Parameter]
|
||||
public string ConfirmText { get; set; } = "Ja, bestätigen";
|
||||
|
||||
[Parameter]
|
||||
public string CancelText { get; set; } = "Nein, abbrechen";
|
||||
|
||||
[Parameter]
|
||||
public string ConfirmButtonClass { get; set; } = "btn btn-danger";
|
||||
|
||||
[Parameter]
|
||||
public string ConfirmIconClass { get; set; } = "bi bi-trash";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback OnConfirm { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback OnCancel { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Actions
|
||||
|
||||
private async Task Confirm() => await OnConfirm.InvokeAsync();
|
||||
|
||||
private async Task Cancel() => await OnCancel.InvokeAsync();
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user