button components
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
13
resources/views/components/inputs/button.blade.php
Normal file
13
resources/views/components/inputs/button.blade.php
Normal 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>
|
||||
@@ -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)
|
||||
@@ -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 />
|
||||
|
||||
Reference in New Issue
Block a user