@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel>
@using Dynamicweb.Frontend
@using Dynamicweb.Frontend.Navigation

@if (!Model.Nodes.Any()) return;

<div class="offcanvas-header offcanvas-animate-in z-2 bg-body" style="grid-area: Header;">
    <button type="button" class="btn icon-3 p-2 ms-n3" @@click="$dispatch('close-offcanvas');">
        @ReadFile("/Files/Images/Icons/chevron-left.svg")
    </button>
    <button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
</div>
<div class="offcanvas-body offcanvas-animate-in z-2 bg-body" style="grid-area: Body;">

    <ul class="navbar-nav" data-swift-menu-nav>
        @foreach (var node in Model.Nodes)
        {        
            <li class="hstack">
                <a href="@(node.IsClickable ? node.Link : null)" class="hstack gap-3 flex-fill text-decoration-none fs-5">
                    @if (node.Icon is not null && node.Icon.IsSvg() && node.Icon.Path is not null)
                    {
                        <span class="icon">
                            @ReadFile(node.Icon.Path)
                        </span>
                    }
                    <span class="fw-bold">@node.Name</span>
                </a>
            </li>
        }
    </ul>

</div>