Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/views/cart/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
href="{{ route('checkout') }}"
class="w-full text-center"
v-bind:class="{ 'pointer-events-none': !canOrder }"
loader
>
@lang('Checkout')
</x-rapidez::button.conversion>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/checkout/pages/credentials.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class="flex flex-col gap-5"
@include('rapidez::checkout.steps.shipping_method')
</template>

<x-rapidez::button.conversion type="submit" data-testid="continue" class="self-start">
<x-rapidez::button.conversion type="submit" data-testid="continue" class="self-start" loader>
@lang('Next')
</x-rapidez::button.conversion>
</form>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/checkout/pages/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class="max-w-md mx-auto"
>
@include('rapidez::checkout.steps.login')

<x-rapidez::button.conversion type="submit" data-testid="continue" class="mt-3">
<x-rapidez::button.conversion type="submit" data-testid="continue" class="mt-3" loader>
@lang('Next')
</x-rapidez::button.conversion>
</form>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/checkout/steps/place_order.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
v-slot="{ mutate, variables }"
>
<fieldset>
<x-rapidez::button.conversion type="submit" data-testid="continue" class="mt-3">
<x-rapidez::button.conversion type="submit" data-testid="continue" class="mt-3" loader>
@lang('Place order')
</x-rapidez::button.conversion>
</fieldset>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/autocomplete/input.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class="absolute right-14 top-1/2 -translate-y-1/2 transition-opacity opacity-100
<x-heroicon-s-x-mark class="size-7" />
</button>
<x-rapidez::button
class="absolute right-0 top-0 bg-opacity-0 hover:bg-opacity-0 border-none *:peer-placeholder-shown:bg-muted *:peer-placeholder-shown:text"
class="absolute right-0 top-0 bg-opacity-0 hover:bg-opacity-0 border-none [&>span>div]:peer-placeholder-shown:bg-muted [&>span>div]:peer-placeholder-shown:text"
type="submit"
title="@lang('Search')"
:title="__('Search')"
>
<x-rapidez::autocomplete.magnifying-glass />
</x-rapidez::button>
Expand Down
15 changes: 2 additions & 13 deletions resources/views/components/button/base.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
@props(['tag' => 'button', 'disableWhenLoading' => true])

@php
$tag = $attributes->hasAny('href', ':href', 'v-bind:href') ? 'a' : $tag;
$tag = $attributes->has('for') ? 'label' : $tag;
@endphp

<x-rapidez::tag
is="{{ $tag }}"
{{ $attributes->merge([
':disabled' => $attributes->has('href') || $attributes->has(':href') || !$disableWhenLoading ? null : '$root.loading']) }}
>
<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') }}>
{{ $slot }}
</x-rapidez::tag>
</x-rapidez::button.tag>
27 changes: 27 additions & 0 deletions resources/views/components/button/tag.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@props(['tag' => 'button', 'disableWhenLoading' => true, 'loader' => false])

@php
$tag = $attributes->hasAny('href', ':href', 'v-bind:href') ? 'a' : $tag;
$tag = $attributes->has('for') ? 'label' : $tag;
if ($loader) {
$attributes['v-bind:disabled'] = 'loading';
}
@endphp

<x-rapidez::tag
is="{{ $tag }}"
{{ $attributes->merge([
':disabled' => $attributes->has('href') || $attributes->has(':href') || !$disableWhenLoading ? null : '$root.loading',
]) }}
>
<span class="contents" @if ($loader) v-bind:class="{'invisible': loading}" @endif>
{{ $slot }}
</span>

@if ($loader)
<div v-if="loading" class="absolute right-1/2 bottom-1/2 translate-x-1/2 translate-y-1/2" v-cloak>
<x-heroicon-o-arrow-path class="animate-spin size-5"/>
</div>
@endif
</x-rapidez::tag>
Loading