

<div class="top-row ps-3 navbar navbar-dark">
    <div class="container-fluid">
        <a class="navbar-brand" href="">حق تو</a>
        <button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
            <span class="navbar-toggler-icon"></span>
        </button>
    </div>
</div>

<div  @onclick="ToggleNavMenu">
    <nav class="flex-column">
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
                <span class="oi oi-home" aria-hidden="true"></span> خانه
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="Subjects">
                <span class="oi oi-list-rich" aria-hidden="true"></span> موضوعات
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="Words/word">
                <span class="oi oi-list-rich" aria-hidden="true"></span>دیکشنری
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="Words/bills">
                <span class="oi oi-list-rich" aria-hidden="true"></span>لوایح و اسناد
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="Questions">
                <span class="oi oi-list-rich" aria-hidden="true"></span> سوالات
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="SuitTrees">
                <span class="oi oi-list-rich" aria-hidden="true"></span> درختان شکایت
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" @onclick="Signout">
                <span class="oi oi-account-logout" aria-hidden="true"></span> خروج
            </NavLink>
        </div>
    </nav>
</div>

@code {
    private bool collapseNavMenu = true;

    private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;

    private void ToggleNavMenu()
    {
        collapseNavMenu = !collapseNavMenu;
    }
    private async Task Signout()
    {
        var confirm = await SwalUtils.ShowSwal(title: "", message: "از خروج اطمینان دارید؟", icon: SweetAlertIcon.Question);
        if (!confirm.IsConfirmed)
            return;
        await LocalStorage.RemoveItemAsync(Statics.LoginTokenKey);
        NavManager.NavigateTo("/Login");

    }
}
