This commit is contained in:
Andras Bacsai
2023-05-17 15:46:20 +02:00
parent c350018716
commit f2e91f97ed
14 changed files with 430 additions and 251 deletions

View File

@@ -1,29 +1,12 @@
@props([
'isWarning' => null,
'isBold' => false,
'disabled' => null,
'defaultClass' => 'text-white hover:bg-coollabs h-10 rounded transition-colors',
'defaultWarningClass' => 'text-red-500 hover:text-white hover:bg-red-600 h-10 rounded',
'disabledClass' => 'text-neutral-400 h-10 rounded',
'loadingClass' => 'text-black bg-green-500 h-10 rounded',
'confirm' => null,
'confirmAction' => null,
])
<button {{ $attributes }} @class([
$defaultClass => !$confirm && !$isWarning && !$disabled && !$isBold,
$defaultWarningClass => ($confirm || $isWarning) && !$disabled,
$disabledClass => $disabled,
$isBold => $isBold
? 'bg-coollabs text-white hover:bg-coollabs-100 h-10 rounded transition-colors'
: '',
]) @if ($attributes->whereStartsWith('wire:click') && !$disabled)
wire:target="{{ explode('(', $attributes->whereStartsWith('wire:click')->first())[0] }}"
wire:loading.delay.class="{{ $loadingClass }}" wire:loading.delay.attr="disabled"
wire:loading.delay.class.remove="{{ $defaultClass }} {{ $attributes->whereStartsWith('class')->first() }}"
@endif
@if ($disabled !== null)
disabled title="{{ $disabled }}"
@endif
<button {{ $attributes }}
@if ($attributes->whereStartsWith('wire:click') && !$disabled) wire:target="{{ explode('(', $attributes->whereStartsWith('wire:click')->first())[0] }}"
wire:loading.delay.class='loading' wire:loading.delay.attr="disabled" @endif
@if ($disabled !== null) disabled title="{{ $disabled }}" @endif
@isset($confirm)
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
@endisset