@namespace Lumeo

<div class="@CssClass" @attributes="AdditionalAttributes">
    @ChildContent
</div>

@code {
    [CascadingParameter] public SidebarProvider.SidebarState? State { get; set; }
    [Parameter] public RenderFragment? ChildContent { get; set; }
    [Parameter] public string? Class { get; set; }
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object>? AdditionalAttributes { get; set; }

    private bool IsCollapsed => State?.IsCollapsed ?? false;

    private string CssClass => string.Join(" ", new[] { "px-3 py-1 text-xs font-medium text-muted-foreground", IsCollapsed ? "sr-only" : null, Class }.Where(s => !string.IsNullOrWhiteSpace(s)));
}
