43 lines
1.5 KiB
PHP
43 lines
1.5 KiB
PHP
@props(['variant' => '', 'icon' => '', 'link' => '', 'external' => false, 'round' => false])
|
|
@php
|
|
$variants = [
|
|
'neutral' => 'bg-primary-600 text-white hover:bg-gray-200 hover:text-gray-900',
|
|
'red' => 'bg-red-500 text-white hover:bg-red-400 hover:text-red-800',
|
|
'ghost' => 'bg-gray-200 text-gray-900 hover:bg-primary-600 hover:text-white'
|
|
];
|
|
|
|
$variantClass = $variants[$variant] ?? '';
|
|
$roundedClass = $round ? ' rounded-full p-3' : ' rounded-lg magnifying-glass px-4 py-2 ';
|
|
$variantClass.= $roundedClass;
|
|
@endphp
|
|
@if($link !== '')
|
|
<a
|
|
@if($external)
|
|
target="_blank"
|
|
@endif
|
|
{{$attributes->merge([
|
|
'class' => "block px-4 py-2 font-medium hover:opacity-80 active:scale-80 transition-all ease-in-out duration-300 $variantClass",
|
|
'href' => $link]
|
|
)}}>
|
|
<div class="flex justify-center items-center space-x-2">
|
|
@if($icon !=='')
|
|
@svg("heroicon-o-$icon", 'w-5 h-5')
|
|
@endif
|
|
@if(isset($slot))
|
|
<p>{{$slot}}</p>
|
|
@endif
|
|
</div>
|
|
</a>
|
|
@else
|
|
<button {{$attributes->merge(['class' => "font-medium active:scale-80 transition-all ease-in-out duration-300 $variantClass", 'type'=>'submit'])}}>
|
|
<div class="flex justify-center items-center md:space-x-2">
|
|
@if($icon !=='')
|
|
@svg("heroicon-o-$icon", 'w-5 h-5')
|
|
@endif
|
|
@if(filled($slot))
|
|
{{$slot}}
|
|
@endif
|
|
</div>
|
|
</button>
|
|
@endif
|