update
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
@php
|
||||
$tag = 'button';
|
||||
$href = null;
|
||||
|
||||
if ($route) {
|
||||
$href = route($route);
|
||||
$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 shadow-md px-2 py-1 rounded-2';
|
||||
|
||||
$variants = [
|
||||
'primary' => 'bg-primary',
|
||||
'secondary' => 'bg-secondary',
|
||||
'outline' => 'bg-outline',
|
||||
'ghost' => 'bg-ghost',
|
||||
'link' => 'bg-link',
|
||||
'destructive' => 'bg-destructive',
|
||||
];
|
||||
|
||||
$sizes = [
|
||||
'default' => 'h-10',
|
||||
'sm' => 'h-6',
|
||||
'lg' => 'h-12',
|
||||
'icon' => 'h-10',
|
||||
];
|
||||
|
||||
$variantClass = $variants[$variant] ?? $variants['primary'];
|
||||
$sizeClass = $sizes[$size] ?? $sizes['default'];
|
||||
|
||||
$classes = "{$baseClasses} {$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="{{ $type }}" {{ $attributes->merge(['class' => $classes]) }}>
|
||||
@if($icon)
|
||||
<i data-lucide="{{ $icon }}" class="w-1 h-1 mr-2"></i>
|
||||
@endif
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@endif
|
||||
Reference in New Issue
Block a user