@namespace Lumeo

@{
    var context = new ListContext(Bordered, Hoverable, Size);
}

<CascadingValue Value="context" IsFixed="false">
    <ul role="list" class="@CssClass" @attributes="AdditionalAttributes">
        @ChildContent
    </ul>
</CascadingValue>

@code {
    [Parameter] public RenderFragment? ChildContent { get; set; }
    [Parameter] public bool Bordered { get; set; }
    [Parameter] public bool Hoverable { get; set; }
    [Parameter] public ListSize Size { get; set; } = ListSize.Default;
    [Parameter] public string? Class { get; set; }
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object>? AdditionalAttributes { get; set; }

    private string CssClass => string.Join(" ", new[] { "w-full", Bordered ? "divide-y divide-border rounded-md border border-border" : null, Class }.Where(s => !string.IsNullOrWhiteSpace(s)));

    public record ListContext(bool Bordered, bool Hoverable, ListSize Size);

    public enum ListSize { Sm, Default, Lg }
}
