app/resources/views/components/button.blade.php

21 lines
714 B
PHP
Raw Normal View History

@props([
'variant' => 'primary',
'type' => 'button',
])
@php
$baseClasses = 'px-4 py-2 rounded transition-colors duration-200 disabled:opacity-50';
$variantClasses = match($variant) {
'primary' => 'bg-primary text-white hover:bg-secondary',
'outline' => 'border-2 border-secondary text-gray-100 hover:bg-gray-700',
'danger' => 'bg-danger text-white hover:bg-red-700',
'danger-outline' => 'border-2 border-danger text-danger hover:bg-danger hover:text-white',
default => 'bg-secondary text-white hover:bg-secondary',
};
@endphp
<button type="{{ $type }}" {{ $attributes->merge(['class' => "$baseClasses $variantClasses"]) }}>
{{ $slot }}
</button>