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

47 lines
2.0 KiB
PHP
Raw Normal View History

2023-05-03 12:09:10 +00:00
@props([
2023-05-18 11:26:35 +00:00
'type' => $attributes->get('type') ?? 'button',
2023-05-09 09:33:50 +00:00
'disabled' => null,
2023-05-03 12:09:10 +00:00
'confirm' => null,
'confirmAction' => null,
2023-05-22 08:34:00 +00:00
'tooltip' => null,
2023-05-03 12:09:10 +00:00
])
2023-05-22 09:21:03 +00:00
@isset($tooltip)
<div class="tooltip tooltip-warning" data-tip="{{ $tooltip }}">
@endisset
2023-05-22 08:34:00 +00:00
@if ($type === 'submit')
2023-06-06 06:43:01 +00:00
<button
{{ $attributes->class(['btn btn-xs border-none no-animation normal-case text-white rounded', 'hover:bg-coolgray-400 bg-coolgray-200 h-7' => !$attributes->has('class')]) }}
type="submit" @if ($disabled !== null) disabled @endif
2023-05-22 08:34:00 +00:00
@isset($confirm)
2023-05-04 13:45:53 +00:00
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
2023-05-03 13:02:21 +00:00
@endisset
2023-05-22 08:34:00 +00:00
@isset($confirmAction)
2023-05-04 13:45:53 +00:00
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
2023-05-03 13:02:21 +00:00
@endisset>
2023-06-02 11:18:10 +00:00
@if ($attributes->whereStartsWith('wire:click')->first())
<span wire:target="submit" wire:loading.delay class="loading loading-spinner"></span>
@endif
2023-05-22 08:34:00 +00:00
{{ $slot }}
</button>
@elseif($type === 'button')
2023-06-05 11:50:34 +00:00
<button
{{ $attributes->class(['btn btn-xs border-none no-animation normal-case text-white rounded', 'hover:bg-coolgray-400 bg-coolgray-200 h-7' => !$attributes->has('class')]) }}
@if ($disabled !== null) disabled @endif type="button"
2023-05-22 08:34:00 +00:00
@isset($confirm)
2023-05-18 11:26:35 +00:00
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
@endisset
2023-05-22 08:34:00 +00:00
@isset($confirmAction)
2023-05-18 11:26:35 +00:00
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
@endisset>
2023-06-02 11:18:10 +00:00
@if ($attributes->whereStartsWith('wire:click')->first())
<span wire:target="{{ explode('(', $attributes->whereStartsWith('wire:click')->first())[0] }}"
wire:loading.delay class="loading loading-spinner"></span>
@endif
2023-05-22 08:34:00 +00:00
{{ $slot }}
</button>
@endif
2023-05-22 09:21:03 +00:00
@isset($tooltip)
</div>
@endisset