25 lines
1.1 KiB
PHP
25 lines
1.1 KiB
PHP
@props([
|
|
'variant' => 'secondary', // primary | secondary | ghost | danger
|
|
'as' => 'button', // 'button' | 'a'
|
|
'disabled' => false,
|
|
])
|
|
|
|
@php
|
|
// Jednolity styl przycisków dla CAŁEGO projektu. Zawsze pigułka px-5 py-2.5.
|
|
$base = 'inline-flex items-center justify-center px-5 py-2.5 rounded-full font-title-sm text-title-sm transition-all';
|
|
$variants = [
|
|
'primary' => 'bg-primary text-on-primary hover:bg-primary-container active:scale-95 shadow-card',
|
|
'secondary' => 'bg-secondary text-on-secondary hover:opacity-90 active:scale-95',
|
|
'ghost' => 'text-on-surface-variant hover:bg-surface-container',
|
|
'danger' => 'bg-error text-on-error hover:opacity-90 active:scale-95',
|
|
];
|
|
$v = $variants[$variant] ?? $variants['secondary'];
|
|
$cls = $base.' '.$v.($disabled ? ' opacity-50 cursor-not-allowed pointer-events-none' : '');
|
|
@endphp
|
|
|
|
@if ($as === 'a')
|
|
<a {{ $attributes->merge(['class' => $cls]) }}>{{ $slot }}</a>
|
|
@else
|
|
<button @disabled($disabled) {{ $attributes->merge(['type' => 'button', 'class' => $cls]) }}>{{ $slot }}</button>
|
|
@endif
|