lasthourcloud/resources/views/components/inputs/button.blade.php

15 lines
747 B
PHP
Raw Normal View History

2023-05-03 12:09:10 +00:00
@props([
2023-05-03 12:40:58 +00:00
'class' => null,
2023-05-03 12:36:53 +00:00
'defaultClass' => 'text-white bg-violet-500 hover:bg-violet-600',
2023-05-03 12:09:10 +00:00
'confirm' => null,
'confirmAction' => null,
])
2023-05-03 12:40:58 +00:00
<button {{ $attributes }} {{ $attributes->merge(['class' => "$defaultClass $class"]) }}
2023-05-03 12:09:10 +00:00
@if ($attributes->whereStartsWith('wire:click')) wire:target="{{ $attributes->whereStartsWith('wire:click')->first() }}"
wire:loading.class="text-black bg-green-500" wire:loading.attr="disabled" wire:loading.class.remove="{{ $defaultClass }} {{ $attributes->whereStartsWith('class')->first() }}" @endif
@isset($confirm) x-on:click="toggleConfirmModal('{{ $confirm }}')" @endisset
@isset($confirmAction) @confirm.window="$wire.{{ $confirmAction }}()" @endisset>
{{ $slot }}
</button>