- 그룹 헤더: text-sm font-semibold (기존 text-xs font-bold uppercase) - 하위 메뉴: font-normal (기존 font-medium) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
@props(['menu', 'depth' => 0])
|
|
|
|
@php
|
|
$sidebarMenuService = app(\App\Services\SidebarMenuService::class);
|
|
$isActive = $sidebarMenuService->isMenuActive($menu);
|
|
$paddingLeft = $depth > 0 ? ($depth * 0.75 + 0.75) . 'rem' : '0.75rem';
|
|
|
|
$url = $menu->url;
|
|
if ($menu->is_external && $menu->external_url) {
|
|
$url = $menu->external_url;
|
|
}
|
|
|
|
// 라우트명이 있으면 라우트 URL 사용
|
|
$routeName = $menu->getRouteName();
|
|
if ($routeName && !str_contains($routeName, '*') && \Route::has($routeName)) {
|
|
$url = route($routeName);
|
|
}
|
|
|
|
$activeClass = $isActive
|
|
? 'bg-primary text-white hover:bg-primary'
|
|
: 'text-gray-700 hover:bg-gray-100';
|
|
|
|
$target = $menu->is_external ? '_blank' : '_self';
|
|
@endphp
|
|
|
|
<li>
|
|
<a href="{{ $url }}"
|
|
class="flex items-center gap-2 px-3 py-2 rounded-lg text-sm {{ $activeClass }}"
|
|
style="padding-left: {{ $paddingLeft }}"
|
|
title="{{ $menu->name }}"
|
|
@if($menu->is_external) target="{{ $target }}" rel="noopener noreferrer" hx-boost="false" @endif
|
|
>
|
|
@if($menu->icon)
|
|
<x-sidebar.menu-icon :icon="$menu->icon" />
|
|
@endif
|
|
<span class="sidebar-text">{{ $menu->name }}</span>
|
|
@if($menu->is_external)
|
|
<x-sidebar.menu-icon icon="external-link" class="w-3 h-3 opacity-50" />
|
|
@endif
|
|
</a>
|
|
</li>
|