40 lines
866 B
PHP
40 lines
866 B
PHP
@props([
|
|
'variant' => '',
|
|
'size' => 'default',
|
|
'type' => 'button',
|
|
'class' => '',
|
|
'label' => '',
|
|
'href' => null ])
|
|
|
|
@php
|
|
$variantClass = match ($variant) {
|
|
'primary' => 'button--primary',
|
|
'secondary' => 'button--secondary',
|
|
default => '',
|
|
};
|
|
|
|
$sizeClass = match ($size) {
|
|
'sm' => 'button--sm',
|
|
'lg' => 'button--lg',
|
|
default => '',
|
|
};
|
|
|
|
$element = match ($type) {
|
|
'anchor' => 'a',
|
|
'button' => 'button type="button"',
|
|
'submit' => 'button type="submit"',
|
|
default => 'button',
|
|
};
|
|
|
|
$type = match ($type) {
|
|
'anchor' => '',
|
|
'button' => 'type="button"',
|
|
'submit' => 'type="submit"',
|
|
default => '',
|
|
}
|
|
@endphp
|
|
|
|
<{{ $element }} {{ $type }} class="button button--icon {{ $variantClass }} {{ $sizeClass }} {{ $class }}" aria-label="{{ $label }}" href="{{ $href }}">
|
|
{{ $slot }}
|
|
</{{ $element }}>
|