Skip to content

Commit

Permalink
feat: create menu item component (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
ADchasacademy authored Feb 7, 2025
2 parents 85fb3b6 + aa48683 commit 7d58725
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions resources/views/components/menu-item.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@props([
'label',
'variant' => 'default',
'href',
])

@php
$baseClasses = 'block rounded-lg px-4 py-2 text-center transition-all duration-200 ease-out';
$hoverClasses = 'hover:bg-slate-600';
$variantClasses = match ($variant) {
'highlights' => 'font-bold text-indigo-400',
'destructive' => 'text-red-400',
default => 'text-slate-200',
};
@endphp

@if ($href)
<a
href="{{ $href }}"
{{ $attributes->twMerge(['class' => "$baseClasses $variantClasses $hoverClasses"]) }}
>
{{ $label }}
</a>
@else
<button
{{ $attributes->twMerge(['class' => "$baseClasses $variantClasses $hoverClasses"]) }}
>
{{ $label }}
</button>
@endif

0 comments on commit 7d58725

Please sign in to comment.