@namespace Lumeo
@inject Lumeo.Services.Localization.ILumeoLocalizer L

<button class="@CssClass" @onclick="State.Toggle" title="@L["Sidebar.Toggle"]" @attributes="AdditionalAttributes">
    @if (State?.IsCollapsed == true)
    {
        <Blazicon Svg="Lucide.PanelLeftOpen" class="h-4 w-4" />
    }
    else
    {
        <Blazicon Svg="Lucide.PanelLeftClose" class="h-4 w-4" />
    }
</button>

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

    private string CssClass => $"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-[1.5px] focus-visible:ring-ring focus-visible:ring-offset-2 h-9 w-9 {Class}".Trim();
}
