@props([
'variant' => 'primary',
'size' => 'md',
'icon' => null,
'iconRight' => null,
'href' => null,
'loading' => null,
'type' => 'button',
])
@php
$base = 'inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors disabled:opacity-60 disabled:pointer-events-none whitespace-nowrap';
$variants = [
'primary' => 'bg-emerald-600 text-white hover:bg-emerald-700',
'secondary' => 'bg-secondary text-secondary-foreground hover:bg-muted',
'outline' => 'border border-gray-200 dark:border-border text-foreground hover:bg-gray-50 dark:hover:bg-muted',
'danger' => 'bg-rose-600 text-white hover:bg-rose-700',
'ghost' => 'text-foreground hover:bg-gray-100 dark:hover:bg-muted',
];
$sizes = [
'sm' => 'px-3 py-1.5 text-sm',
'md' => 'px-4 py-2 text-sm',
'lg' => 'px-5 py-2.5 text-base',
'icon' => 'p-2',
];
$classes = $base.' '.($variants[$variant] ?? $variants['primary']).' '.($sizes[$size] ?? $sizes['md']);
@endphp
@if ($href)
merge(['class' => $classes]) }}>
@if ($icon)@endif
{{ $slot }}
@if ($iconRight)@endif
@else
@endif