38 lines
1004 B
Plaintext
38 lines
1004 B
Plaintext
<MudDialog>
|
|
<DialogContent>
|
|
<MudTextField @bind-Value="_name"
|
|
Label="Preset name"
|
|
Variant="Variant.Outlined"
|
|
Immediate="true"
|
|
MaxLength="100"
|
|
Autofocus="true" />
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton OnClick="Cancel">Cancel</MudButton>
|
|
<MudButton Color="Color.Primary"
|
|
Variant="Variant.Filled"
|
|
OnClick="Save"
|
|
Disabled="@string.IsNullOrWhiteSpace(_name)">
|
|
Save
|
|
</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
@code {
|
|
[CascadingParameter]
|
|
IMudDialogInstance MudDialog { get; set; } = null!;
|
|
|
|
private string _name = string.Empty;
|
|
|
|
private void Save()
|
|
{
|
|
var name = _name.Trim();
|
|
if (string.IsNullOrWhiteSpace(name))
|
|
return;
|
|
|
|
MudDialog.Close(DialogResult.Ok(name));
|
|
}
|
|
|
|
private void Cancel() => MudDialog.Cancel();
|
|
}
|