UI/Modals/NetplayCycleRow.razor
@using Sandbox.UI

@namespace Emulotl

@inherits Panel

<root class="@RowClass" onmouseenter=@OnHovered onclick=@(() => OnCycled(1))>
	<SelectionRing Active=@Active StrokeWidth=@(8f) CornerRadius=@(8f) Gap=@(0f) Alpha=@RingAlpha class="netplay-row-ring" />
	<div class="netplay-row-name">@Label</div>
	<div class="netplay-row-value">
		<div class="netplay-chevron" onclick=@((PanelEvent e) => OnChevron(e, -1))>chevron_left</div>
		<div class="netplay-value-label">@Value</div>
		<div class="netplay-chevron" onclick=@((PanelEvent e) => OnChevron(e, 1))>chevron_right</div>
	</div>
</root>

@code
{
	[Parameter] public string Label { get; set; }
	[Parameter] public string Value { get; set; }
	[Parameter] public bool Active { get; set; }
	[Parameter] public float RingAlpha { get; set; } = 1f;
	[Parameter] public Action Hovered { get; set; }
	[Parameter] public Action<int> Cycled { get; set; }

	private string RowClass => "netplay-cyclerow" + (Active ? " focus" : "");

	private void OnHovered() => Hovered?.Invoke();
	private void OnCycled(int dir) => Cycled?.Invoke(dir);

	private void OnChevron(PanelEvent e, int dir)
	{
		e.StopPropagation();
		OnCycled(dir);
	}
}