2022-01-20 08:34:38 +00:00
|
|
|
@namespace Wabbajack.App.Blazor.Components
|
|
|
|
|
|
|
|
<label class="option">
|
2022-01-17 16:45:52 +00:00
|
|
|
@Label
|
2022-01-28 11:58:28 +00:00
|
|
|
<input type="checkbox" value="@IsChecked" @onchange="CheckBoxChanged">
|
2022-01-17 16:45:52 +00:00
|
|
|
<span class="checkmark"></span>
|
|
|
|
</label>
|
|
|
|
|
|
|
|
@code {
|
|
|
|
// TODO: [Low] Implement parameters to customize style.
|
2022-01-28 11:58:28 +00:00
|
|
|
|
2022-01-17 16:45:52 +00:00
|
|
|
[Parameter]
|
2022-01-28 11:58:28 +00:00
|
|
|
public string? Label { get; set; }
|
|
|
|
|
2022-01-17 16:45:52 +00:00
|
|
|
[Parameter]
|
2022-01-28 11:58:28 +00:00
|
|
|
public bool IsChecked { get; set; }
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
public EventCallback<bool> IsCheckedChanged { get; set; }
|
2022-01-17 16:45:52 +00:00
|
|
|
|
|
|
|
private async Task CheckBoxChanged(ChangeEventArgs e)
|
|
|
|
{
|
2022-01-28 11:58:28 +00:00
|
|
|
if (e.Value is not bool newValue) return;
|
|
|
|
if (IsChecked == newValue) return;
|
|
|
|
|
|
|
|
IsChecked = newValue;
|
|
|
|
await IsCheckedChanged.InvokeAsync(IsChecked);
|
2022-01-17 16:45:52 +00:00
|
|
|
}
|
|
|
|
}
|