button components

This commit is contained in:
Andras Bacsai
2023-05-03 14:09:10 +02:00
parent 612460ca16
commit abf778ce86
31 changed files with 198 additions and 214 deletions

View File

@@ -16,8 +16,8 @@
<div class="flex flex-col items-center justify-center h-full">
<div class="pb-5 text-white" x-text="message"></div>
<div>
<button x-on:click="open = false">Cancel</button>
<button x-on:click="$dispatch('confirm')">Confirm</button>
<x-inputs.button x-on:click="$dispatch('confirm')">Confirm</x-inputs.button>
<x-inputs.button x-on:click="open = false">Cancel</x-inputs.button>
</div>
</div>
</div>

View File

@@ -1,11 +0,0 @@
<label for={{ $id }}>
@if ($label)
{{ $label }}
@else
{{ $id }}
@endif
@if ($required)
*
@endif
<input id={{ $id }} type={{ $type }} wire:model.defer={{ $id }}>
</label>

View File

@@ -0,0 +1,13 @@
@props([
'defaultClass' => 'bg-indigo-500',
'confirm' => null,
'confirmAction' => null,
])
<button {{ $attributes }} {{ $attributes->merge(['class' => $defaultClass]) }}
@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>

View File

@@ -1,3 +1,15 @@
@props([
'id' => null,
'required' => false,
'readonly' => false,
'label' => null,
'type' => 'text',
'class' => '',
'instantSave' => false,
'disabled' => false,
'hidden' => false,
])
@if ($type === 'checkbox')
<label for={{ $id }}>
@if ($label)

View File

@@ -11,7 +11,7 @@
@endif
<form action="/logout" method="POST">
@csrf
<button type="submit">Logout</button>
<x-inputs.button type="submit">Logout</x-inputs.button>
</form>
<livewire:check-update />
<livewire:force-upgrade />