Private
Public Access
1
0

Extension Install

This commit is contained in:
root
2025-12-03 14:23:33 +01:00
parent a06fdcb317
commit 2cea264127
29 changed files with 1795 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
@props(['link', 'class' => ''])
@php
$href = '';
$spa = true;
// Determine the href based on link type
if (isset($link['direct_url'])) {
// Custom path or external URL
$href = $link['direct_url'];
$spa = false; // Disable SPA for custom URLs
} elseif (isset($link['route'])) {
// Laravel route
try {
$href = route($link['route'], $link['params'] ?? []);
} catch (\Exception $e) {
// If route doesn't exist, skip this link
$href = '#';
}
} else {
$href = '#'; // Fallback
}
@endphp
@if($href !== '#')
<a href="{{ $href }}"
{{ $attributes->merge(['class' => 'flex flex-row items-center gap-2 text-sm font-semibold text-wrap ' . $class . ' ' . ($href === request()->url() ? 'text-primary' : 'text-base hover:text-base/80')]) }}
@if($spa) wire:navigate @endif>
@if(isset($link['icon']))
<i class="{{ $link['icon'] }}"></i>
@endif
{{ $link['name'] }}
</a>
@endif

View File

@@ -0,0 +1,31 @@
@props(['links' => []])
@if(count($links) > 0)
@foreach($links as $nav)
@if (isset($nav['children']) && count($nav['children']) > 0)
{{-- Dropdown link --}}
<div class="relative">
<x-dropdown>
<x-slot:trigger>
<div class="flex flex-col">
<span class="flex flex-row items-center p-3 text-sm font-semibold whitespace-nowrap text-base hover:text-base/80">
@if(isset($nav['icon']))
<i class="{{ $nav['icon'] }} mr-2"></i>
@endif
{{ $nav['name'] }}
</span>
</div>
</x-slot:trigger>
<x-slot:content>
@foreach ($nav['children'] as $child)
<x-navbar-manager::custom-link :link="$child" />
@endforeach
</x-slot:content>
</x-dropdown>
</div>
@else
{{-- Single link --}}
<x-navbar-manager::custom-link :link="$nav" class="flex items-center p-3" />
@endif
@endforeach
@endif