@props([
    'label' => null,
    'name' => null,
    'icon' => null,
    'route' => null
])

@php
    $routePattern = $route ?? ('admin.' . $name . '.*');
    $sidebarId = 'sidebar' . str_replace('-', '', ucwords($name, '-'));
@endphp

<li class="nav-item">
    <a class="nav-link menu-link {{ request()->routeIs($routePattern) ? 'active' : '' }}" href="#{{ $sidebarId }}" data-bs-toggle="collapse" role="button"
        aria-expanded="{{ request()->routeIs($routePattern) ? 'true' : 'false' }}"
        aria-controls="{{ $sidebarId }}">
        <i class="{{ $icon }}"></i> <span data-key="t-{{ $name }}">{{ $label }}</span>
    </a>

    <div class="collapse menu-dropdown {{ request()->routeIs($routePattern) ? 'show' : '' }}"
        id="{{ $sidebarId }}">
        <ul class="nav nav-sm flex-column">
            {{ $slot }}
        </ul>
    </div>
</li>
