Skip to content

Commit 1a33b14

Browse files
committed
Button
1 parent f53bd88 commit 1a33b14

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

config/template-components.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@
1010
'error-div' => 'invalid-feedback',
1111
'input-error' => 'is-invalid',
1212
],
13+
'button' => [
14+
'button' => 'btn',
15+
'indicator-progress' => ' d-block',
16+
'spinner-class'
17+
]
1318
],
1419
];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<button {{ $attributes->merge(['class' => config('template-components.defult_classes.button.button')]) }} {{ $attributes }} wire:loading.attr="disabled">
2+
<span wire:loading.remove wire:target="{{ $attributes->get('wire:target') }}" class="{{ $attributes->get('span-text') }}">
3+
{{ $slot }}
4+
</span>
5+
6+
<div wire:loading wire:target="{{ $attributes->get('wire:target') }}">
7+
<span class="{{ $attributes->get('indicator-progress-class') }}">
8+
{{ $attributes->get('loading-text') ?? 'Please wait...' }}
9+
<span class="{{ $attributes->get('spinner-class') ?? 'spinner-border spinner-border-sm align-middle ms-2' }} {{ config('template-components.defult_classes.button.spinner-class') }}"></span>
10+
</span>
11+
</div>
12+
</button>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
// test button component
4+
5+
use Illuminate\Support\Facades\View;
6+
7+
it('can render button component', function () {
8+
$this->assertTrue(View::exists('template-components::button'));
9+
});

0 commit comments

Comments
 (0)