Skip to content

Commit bdfaa74

Browse files
Loader button option (#969)
1 parent d6bd730 commit bdfaa74

File tree

8 files changed

+26
-20
lines changed

8 files changed

+26
-20
lines changed

resources/views/cart/sidebar.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
href="{{ route('checkout') }}"
5050
class="w-full text-center"
5151
v-bind:class="{ 'pointer-events-none': !canOrder }"
52+
loader
5253
>
5354
@lang('Checkout')
5455
</x-rapidez::button.conversion>

resources/views/checkout/pages/credentials.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class="flex flex-col gap-5"
3333
@include('rapidez::checkout.steps.shipping-method')
3434
</template>
3535

36-
<x-rapidez::button.conversion type="submit" data-testid="continue" class="self-start">
36+
<x-rapidez::button.conversion type="submit" data-testid="continue" class="self-start" loader>
3737
@lang('Next')
3838
</x-rapidez::button.conversion>
3939
</form>

resources/views/checkout/pages/login.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class="max-w-md mx-auto"
2020
>
2121
@include('rapidez::checkout.steps.login')
2222

23-
<x-rapidez::button.conversion type="submit" data-testid="continue" class="mt-3">
23+
<x-rapidez::button.conversion type="submit" data-testid="continue" class="mt-3" loader>
2424
@lang('Next')
2525
</x-rapidez::button.conversion>
2626
</form>

resources/views/checkout/steps/place-order.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
v-slot="{ mutate, variables }"
99
>
1010
<fieldset>
11-
<x-rapidez::button.conversion type="submit" data-testid="continue" class="mt-3">
11+
<x-rapidez::button.conversion type="submit" data-testid="continue" class="mt-3" loader>
1212
@lang('Place order')
1313
</x-rapidez::button.conversion>
1414
</fieldset>

resources/views/components/autocomplete/input.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class="absolute right-14 top-1/2 -translate-y-1/2 transition-opacity opacity-100
3030
<x-heroicon-s-x-mark class="size-7" />
3131
</button>
3232
<x-rapidez::button
33-
class="absolute right-0 top-0 bg-opacity-0 hover:bg-opacity-0 border-none *:peer-placeholder-shown:bg-muted *:peer-placeholder-shown:text"
33+
class="!absolute right-0 top-0 bg-opacity-0 hover:bg-opacity-0 border-none *:peer-placeholder-shown:bg-muted *:peer-placeholder-shown:text"
3434
type="submit"
35-
title="@lang('Search')"
35+
:title="__('Search')"
3636
>
3737
<x-rapidez::autocomplete.magnifying-glass />
3838
</x-rapidez::button>
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
@props(['tag' => 'button', 'disableWhenLoading' => true])
2-
3-
@php
4-
$tag = $attributes->hasAny('href', ':href', 'v-bind:href') ? 'a' : $tag;
5-
$tag = $attributes->has('for') ? 'label' : $tag;
6-
@endphp
7-
8-
<x-rapidez::tag
9-
is="{{ $tag }}"
10-
{{ $attributes->merge([
11-
':disabled' => $attributes->has('href') || $attributes->has(':href') || !$disableWhenLoading ? null : '$root.loading']) }}
12-
>
1+
<x-rapidez::button.tag {{ $attributes->twMerge('relative inline-flex items-center justify-center transition font-medium text-base rounded min-h-12 py-1.5 px-5 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer gap-x-1.5') }}>
132
{{ $slot }}
14-
</x-rapidez::tag>
3+
</x-rapidez::button.tag>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@props(['tag' => 'button', 'disableWhenLoading' => true, 'loader' => false])
2+
3+
@php
4+
$tag = $attributes->hasAny('href', ':href', 'v-bind:href') ? 'a' : $tag;
5+
$tag = $attributes->has('for') ? 'label' : $tag;
6+
@endphp
7+
8+
<x-rapidez::tag
9+
is="{{ $tag }}"
10+
:v-bind:class="$loader ? '{ \'button-loading\': $root.loading }' : ''"
11+
{{ $attributes->merge([
12+
':disabled' => $attributes->has('href') || $attributes->has(':href') || !$disableWhenLoading ? null : '$root.loading',
13+
]) }}
14+
>
15+
{{ $slot }}
16+
</x-rapidez::tag>
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)