{{-- Button Component - TailServer Theme Usage: Click me Add Server Delete Processing --}} @props([ 'variant' => 'secondary', 'size' => 'md', 'icon' => null, 'iconRight' => null, 'loading' => false, 'loadingText' => null, 'disabled' => false, 'href' => null, 'type' => 'button', 'full' => false, ]) @php $tag = $href ? 'a' : 'button'; $baseClasses = 'group relative inline-flex items-center justify-center gap-2 rounded-lg font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-background disabled:opacity-50 disabled:cursor-not-allowed overflow-hidden'; $variantClasses = [ 'primary' => 'bg-primary text-white border border-primary hover:bg-primary/90 hover:shadow-md hover:shadow-primary/20 active:scale-[0.98] focus:ring-primary/50', 'secondary' => 'bg-background-secondary text-base border border-neutral/30 hover:bg-background-secondary/80 hover:border-neutral/50 active:scale-[0.98] focus:ring-neutral/30', 'outline' => 'bg-transparent text-base border border-neutral/30 hover:bg-neutral/10 hover:border-neutral/50 focus:ring-neutral/30', 'ghost' => 'bg-transparent text-base hover:bg-neutral/10 focus:ring-neutral/20', 'danger' => 'bg-danger text-white border border-danger hover:bg-danger/90 hover:shadow-md hover:shadow-danger/20 active:scale-[0.98] focus:ring-danger/50', 'success' => 'bg-success text-white border border-success hover:bg-success/90 hover:shadow-md hover:shadow-success/20 active:scale-[0.98] focus:ring-success/50', 'warning' => 'bg-warning text-white border border-warning hover:bg-warning/90 hover:shadow-md hover:shadow-warning/20 active:scale-[0.98] focus:ring-warning/50', 'info' => 'bg-info text-white border border-info hover:bg-info/90 hover:shadow-md hover:shadow-info/20 active:scale-[0.98] focus:ring-info/50', ]; $sizeClasses = [ 'xs' => 'px-2 py-1 text-xs', 'sm' => 'px-2.5 py-1.5 text-sm', 'md' => 'px-3.5 py-2 text-sm', 'lg' => 'px-4 py-2.5 text-base', 'xl' => 'px-5 py-3 text-lg', ]; $iconSizes = [ 'xs' => 'size-3', 'sm' => 'size-3.5', 'md' => 'size-4', 'lg' => 'size-5', 'xl' => 'size-6', ]; $classes = collect([ $baseClasses, $variantClasses[$variant] ?? $variantClasses['secondary'], $sizeClasses[$size] ?? $sizeClasses['md'], $full ? 'w-full' : '', ])->filter()->join(' '); $iconSize = $iconSizes[$size] ?? $iconSizes['md']; @endphp <{{ $tag }} @if($href) href="{{ $href }}" @endif @if($tag === 'button') type="{{ $type }}" @endif @if($disabled || $loading) disabled @endif {{ $attributes->class([$classes]) }} > {{-- Subtle shine effect on hover --}} @if($loading) {{ $loadingText ?? $slot }} @else @if($icon) @endif {{ $slot }} @if($iconRight) @endif @endif