kithkin/resources/views/components/button/icon.blade.php

34 lines
734 B
PHP

@props([
'variant' => '',
'size' => 'default',
'type' => 'button',
'class' => '',
'label' => 'Icon button',
'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',
};
@endphp
<{{ $element }} class="button button--icon {{ $variantClass }} {{ $sizeClass }} {{ $class }}" aria-label="{{ $label }}" href="{{ $href }}">
{{ $slot }}
</{{ $element }}>