update
This commit is contained in:
@@ -20,46 +20,53 @@
|
||||
$tag = 'a';
|
||||
}
|
||||
|
||||
$baseClasses = 'd-inline-flex gap-2 align-items-center justify-content-center text-white px-3 py-2 rounded-3 transition-all border-0';
|
||||
|
||||
$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',
|
||||
'info' => 'bg-info'
|
||||
'primary' => 'btn-primary',
|
||||
'secondary' => 'btn-secondary',
|
||||
'outline' => 'btn-outline-primary',
|
||||
'outline-primary' => 'btn-outline-primary',
|
||||
'outline-secondary' => 'btn-outline-secondary',
|
||||
'outline-success' => 'btn-outline-success',
|
||||
'outline-danger' => 'btn-outline-danger',
|
||||
'outline-warning' => 'btn-outline-warning',
|
||||
'outline-info' => 'btn-outline-info',
|
||||
'ghost' => 'btn-light',
|
||||
'link' => 'btn-link',
|
||||
'danger' => 'btn-danger',
|
||||
'destructive' => 'btn-danger',
|
||||
'success' => 'btn-success',
|
||||
'warning' => 'btn-warning',
|
||||
'info' => 'btn-info',
|
||||
'light' => 'btn-light',
|
||||
'dark' => 'btn-dark',
|
||||
];
|
||||
|
||||
$sizes = [
|
||||
'default' => 'h-10',
|
||||
'sm' => 'h-6',
|
||||
'lg' => 'h-12',
|
||||
'icon' => 'h-10',
|
||||
'default' => '',
|
||||
'sm' => 'btn-sm',
|
||||
'lg' => 'btn-lg',
|
||||
'xs' => 'btn-xs',
|
||||
'icon' => 'btn-icon',
|
||||
];
|
||||
|
||||
$variantClass = $variants[$variant ?? 'primary'] ?? $variants['primary'];
|
||||
$sizeClass = $sizes[$size ?? 'md'] ?? $sizes['default'];
|
||||
$sizeClass = $sizes[$size ?? 'default'] ?? '';
|
||||
|
||||
$classes = "{$baseClasses} {$variantClass} {$sizeClass}";
|
||||
$classes = "btn {$variantClass} {$sizeClass}";
|
||||
@endphp
|
||||
|
||||
@if($tag === 'a')
|
||||
<a href="{{ $href }}" {{ $attributes->merge(['class' => $classes]) }}>
|
||||
@if($icon)
|
||||
<i data-lucide="{{ $icon }}" class="mr-2" style="height: 15px; width: 15px"></i>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</a>
|
||||
@else
|
||||
<button type="{{ $buttonType }}" {{ $attributes->merge(['class' => $classes]) }}>
|
||||
|
||||
@if($tag === 'a')
|
||||
<a href="{{ $href }}" {{ $attributes->merge(['class' => $classes]) }}>
|
||||
@if($icon)
|
||||
<i data-lucide="{{ $icon }}" class="mr-2" style="height: 15px; width: 15px"></i>
|
||||
<i data-lucide="{{ $icon }}" class="me-1" style="height: 14px; width: 14px"></i>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@endif
|
||||
</a>
|
||||
@else
|
||||
<button type="{{ $buttonType }}" {{ $attributes->merge(['class' => $classes]) }}>
|
||||
@if($icon)
|
||||
<i data-lucide="{{ $icon }}" class="me-1" style="height: 14px; width: 14px"></i>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@endif
|
||||
Reference in New Issue
Block a user