{{--
Dropdown Item Component - shadcn-style
--}}
@props([
'href' => null,
'icon' => null,
'variant' => 'default',
'disabled' => false,
])
@php
$tag = $href ? 'a' : 'button';
$variantClasses = [
'default' => 'text-foreground hover:bg-accent hover:text-accent-foreground',
'danger' => 'text-danger focus:bg-danger/10 focus:text-danger',
'success' => 'text-success focus:bg-success/10 focus:text-success',
];
$variantClass = $variantClasses[$variant] ?? $variantClasses['default'];
@endphp
<{{ $tag }}
@if($href) href="{{ $href }}" @endif
@if($tag === 'button') type="button" @endif
@if($disabled) disabled @endif
{{ $attributes->class([
'relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors duration-100 w-full',
$variantClass,
'pointer-events-none opacity-50' => $disabled,
]) }}
>
@if($icon)
@endif
{{ $slot }}
{{ $tag }}>