@php $tag = 'button'; $href = null; $buttonType = $type; if ($type === 'delete' || $confirm) { $tag = 'button'; $buttonType = 'button'; $attributes = $attributes->merge([ 'onclick' => "confirmDelete('$confirmUrl', '$confirmName')", ]); } elseif ($route) { $href = route($route, $params); $tag = 'a'; } elseif ($url) { $href = $url; $tag = 'a'; } elseif ($attributes->has('href')) { $href = $attributes->get('href'); $tag = 'a'; } $baseClasses = 'd-inline-flex gap-2 align-items-center justify-content-center text-white border-0 px-3 py-2 rounded-pill'; $variants = [ 'primary' => 'bg-primary', 'secondary' => 'bg-secondary', 'outline' => 'bg-outline', 'ghost' => 'bg-ghost', 'link' => 'bg-link', 'danger' => 'bg-danger', 'destructive' => 'bg-destructive', 'success' => 'bg-success', 'warning' => 'bg-warning', ]; $sizes = [ 'default' => 'h-10', 'sm' => 'h-6', 'lg' => 'h-12', 'icon' => 'h-10', ]; $variantClass = $variants[$variant ?? 'primary'] ?? $variants['primary']; $sizeClass = $sizes[$size ?? 'md'] ?? $sizes['default']; $classes = "{$baseClasses} {$variantClass} {$sizeClass}"; @endphp @if($tag === 'a') merge(['class' => $classes]) }}> @if($icon) @endif {{ $slot }} @else @endif