Allow one to show an end button

This commit is contained in:
Thorsten Sommer 2024-08-23 11:22:09 +02:00
parent 3fd0d4d5c1
commit aae5ad18db
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 29 additions and 0 deletions

View File

@ -3,6 +3,20 @@
<div class="d-flex align-center">
<MudIcon Icon="@this.HeaderIcon" Size="@this.IconSize" Color="@this.IconColor" class="mr-3"/>
<MudText Typo="Typo.h6">@this.HeaderText</MudText>
@if (this.ShowEndButton)
{
<MudSpacer/>
if (!string.IsNullOrWhiteSpace(this.EndButtonTooltip))
{
<MudTooltip Text="@this.EndButtonTooltip">
<MudIconButton Icon="@this.EndButtonIcon" Color="@this.EndButtonColor" Size="Size.Medium" OnClick="async () => await this.EndButtonClickAsync()"/>
</MudTooltip>
}
else
{
<MudIconButton Icon="@this.EndButtonIcon" Color="@this.EndButtonColor" Size="Size.Medium" OnClick="async () => await this.EndButtonClickAsync()"/>
}
}
</div>
</TitleContent>
<ChildContent>

View File

@ -21,4 +21,19 @@ public partial class ExpansionPanel : ComponentBase
[Parameter]
public bool IsExpanded { get; set; }
[Parameter]
public bool ShowEndButton { get; set; }
[Parameter]
public Func<ValueTask> EndButtonClickAsync { get; set; } = () => ValueTask.CompletedTask;
[Parameter]
public string EndButtonIcon { get; set; } = Icons.Material.Filled.Delete;
[Parameter]
public Color EndButtonColor { get; set; } = Color.Error;
[Parameter]
public string EndButtonTooltip { get; set; } = string.Empty;
}