@using Koogle.Domain.Enums
@PinNumber
@code {
///
/// The pin number (1-9).
///
[Parameter]
public int PinNumber { get; set; }
///
/// Current status of the pin.
///
[Parameter]
public PinStatus Status { get; set; } = PinStatus.Standing;
///
/// Whether the pin is interactive.
///
[Parameter]
public bool IsInteractive { get; set; } = true;
///
/// Callback when pin is clicked.
///
[Parameter]
public EventCallback OnPinClicked { get; set; }
private string GetPinClass() => Status switch
{
PinStatus.Standing => "pin-standing",
PinStatus.Fallen => "pin-fallen",
PinStatus.Disabled => "pin-disabled",
_ => "pin-standing"
};
private string GetStyle()
{
if (!IsInteractive || Status == PinStatus.Disabled)
{
return "pointer-events: none;";
}
return string.Empty;
}
private async Task OnClick()
{
if (!IsInteractive || Status == PinStatus.Disabled)
return;
await OnPinClicked.InvokeAsync(PinNumber);
}
}