Commit awal: prototipe UI SIAKAD Untan
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
@props([
|
||||
'variant' => 'primary',
|
||||
'type' => 'button',
|
||||
'href' => null,
|
||||
'size' => 'md',
|
||||
'block' => false,
|
||||
'icon' => null,
|
||||
'iconOnly' => false,
|
||||
'loading' => false,
|
||||
])
|
||||
|
||||
@php
|
||||
$variant = in_array($variant, ['primary', 'secondary', 'ghost', 'danger'], true) ? $variant : 'primary';
|
||||
$classes = array_filter([
|
||||
'btn',
|
||||
"btn--{$variant}",
|
||||
$size === 'sm' ? 'btn--sm' : null,
|
||||
$block ? 'btn--block' : null,
|
||||
$iconOnly ? 'btn--icon' : null,
|
||||
]);
|
||||
@endphp
|
||||
|
||||
@if ($href)
|
||||
<a href="{{ $href }}" {{ $attributes->class($classes) }}>
|
||||
@if ($icon) <x-dynamic-component :component="'heroicon-o-'.$icon" /> @endif
|
||||
@unless ($iconOnly) <span>{{ $slot }}</span> @endunless
|
||||
</a>
|
||||
@else
|
||||
<button
|
||||
type="{{ $type }}"
|
||||
@if ($loading) data-busy="true" aria-busy="true" @endif
|
||||
{{ $attributes->class($classes) }}
|
||||
>
|
||||
<span class="btn__spinner" aria-hidden="true"></span>
|
||||
@if ($icon) <x-dynamic-component :component="'heroicon-o-'.$icon" /> @endif
|
||||
@unless ($iconOnly) <span>{{ $slot }}</span> @endunless
|
||||
</button>
|
||||
@endif
|
||||
Reference in New Issue
Block a user