@props(['items' => [], 'active' => null, 'mode' => 'side'])

@if($mode === 'tabs')
    <nav class="subnav subnav--tabs" aria-label="서브메뉴 탭">
        @foreach($items as $it)
            @php $isActive = ($active && $active === ($it['key'] ?? $it['url'])); @endphp
            <a href="{{ $it['url'] }}"
               class="subnav-tab {{ $isActive ? 'is-active' : '' }}"
               @if($isActive) aria-current="page" @endif>
                {{ $it['label'] }}
            </a>
        @endforeach
    </nav>
@else
    <nav class="subnav subnav--side" aria-label="서브메뉴">
        <ul class="subnav-list">
            @foreach($items as $it)
                @php $isActive = ($active && $active === ($it['key'] ?? $it['url'])); @endphp
                <li>
                    <a href="{{ $it['url'] }}"
                       class="subnav-link {{ $isActive ? 'is-active' : '' }}"
                       @if($isActive) aria-current="page" @endif>
                        {{ $it['label'] }}
                    </a>
                </li>
            @endforeach
        </ul>
    </nav>
@endif
