Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
|
||||
<button class="icon-button @DisabledClass" @onclick="HandleClick" title="@Title" disabled="@Disabled">
|
||||
<span class="mdi @IconClass"></span>
|
||||
</button>
|
||||
|
||||
@code {
|
||||
[Parameter] public string Icon { get; set; } = string.Empty;
|
||||
[Parameter] public string? Title { get; set; }
|
||||
[Parameter] public EventCallback<MouseEventArgs> OnClick { get; set; }
|
||||
[Parameter] public bool Disabled { get; set; }
|
||||
|
||||
private string IconClass => $"mdi-{Icon} mdi-18px"; /* Giảm icon size để phù hợp với button nhỏ hơn */
|
||||
private string DisabledClass => Disabled ? "disabled" : string.Empty;
|
||||
|
||||
private async Task HandleClick(MouseEventArgs e)
|
||||
{
|
||||
if (Disabled || !OnClick.HasDelegate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
await OnClick.InvokeAsync(e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user