File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ {{--
2
+ A reusable Blade component for defining custom link variants within a menu.
3
+ Supports "default," "highlights," and "destructive" styles.
4
+
5
+ Example Usage:
6
+ <nav>
7
+ <ul class="flex flex-col">
8
+ <li><x-menu-item href="/" label="Edit" /></li>
9
+ <li><x-menu-item href="/" label="Change visibility" /></li>
10
+ <li><x-menu-item href="/" label="Delete" variant="destructive" /></li>
11
+ <li><x-menu-item label="Cancel" variant="highlights" /></li>
12
+ </ul>
13
+ </nav>
14
+ --}}
15
+
16
+ @props ([
17
+ ' label' ,
18
+ ' variant' => ' default' ,
19
+ ' href' => null ,
20
+ ] )
21
+
22
+ @php
23
+ $baseClasses = ' block rounded-lg px-4 py-2 text-center transition-colors duration-200 ease-out ' ;
24
+ $hoverClasses = ' focus:outline-0 hover:bg-slate-600 focus:bg-slate-600' ;
25
+
26
+ $variantClasses = match ($variant ) {
27
+ ' highlights' => ' font-bold text-indigo-400' ,
28
+ ' destructive' => ' text-red-400' ,
29
+ default => ' text-slate-200' ,
30
+ };
31
+ @endphp
32
+
33
+ <a
34
+ href =" {{ $href } }"
35
+ class =" {{ $baseClasses } } {{ $variantClasses } } {{ $hoverClasses } }"
36
+ >
37
+ {{ $label } }
38
+ </a >
You can’t perform that action at this time.
0 commit comments