-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: Improved danger button design
- Loading branch information
1 parent
4bae2e2
commit 130bab3
Showing
1 changed file
with
35 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,45 @@ | ||
@props(['centered' => false, 'iconOnly' => false, 'loadingText' => 'Loading...', 'action' => '']) | ||
@props([ | ||
'centered' => false, | ||
'iconOnly' => false, | ||
'loadingText' => 'Loading...', | ||
'action' => '', | ||
]) | ||
|
||
<button | ||
{{ $attributes->merge([ | ||
'type' => 'submit', | ||
'class' => 'inline-flex items-center ' . | ||
($iconOnly ? 'px-3.5 py-2' : 'px-7 py-2.5') . | ||
' bg-red-600 border border-transparent rounded-[0.70rem] font-semibold text-sm text-white hover:bg-red-500 active:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 transition ease-in-out duration-150' . | ||
($centered ? ' justify-center w-full' : ''), | ||
'type' => 'button', | ||
'class' => 'inline-flex items-center relative overflow-hidden ' . | ||
($iconOnly ? 'p-2.5' : 'px-5 py-2.5') . | ||
' bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 ' . | ||
'border border-gray-300 dark:border-gray-600 ' . | ||
'rounded-[0.7rem] ' . | ||
'font-medium text-sm text-red-600 dark:text-red-400 ' . | ||
'focus:outline-none focus:ring-2 focus:ring-red-500 dark:focus:ring-red-400 ' . | ||
'focus:ring-offset-2 dark:focus:ring-offset-gray-900 ' . | ||
'disabled:opacity-50 disabled:cursor-not-allowed ' . | ||
'transition-all duration-300 ease-in-out ' . | ||
'shadow-sm hover:shadow-md ' . | ||
'group ' . | ||
($centered ? 'justify-center w-full' : ''), | ||
'wire:loading.attr' => 'disabled', | ||
'wire:loading.class' => 'opacity-50 cursor-not-allowed', | ||
'wire:target' => $action | ||
]) }} | ||
> | ||
@if ($action) | ||
<div wire:loading wire:target="{{ $action }}"> | ||
<x-spinner class="mr-2 text-white h-4 w-4 inline"/> | ||
{{ __($loadingText) }} | ||
</div> | ||
<div wire:loading.remove wire:target="{{ $action }}"> | ||
<span class="relative z-10 transition-colors duration-300 ease-in-out group-hover:text-white"> | ||
@if ($action) | ||
<div wire:loading wire:target="{{ $action }}" class="flex items-center"> | ||
<x-spinner class="mr-2 text-red-500 dark:text-red-400 group-hover:text-white h-4 w-4"/> | ||
<span>{{ __($loadingText) }}</span> | ||
</div> | ||
<div wire:loading.remove wire:target="{{ $action }}"> | ||
{{ $slot }} | ||
</div> | ||
@else | ||
{{ $slot }} | ||
</div> | ||
@else | ||
{{ $slot }} | ||
@endif | ||
@endif | ||
</span> | ||
<span class="absolute inset-0 bg-gradient-to-r from-red-600 to-red-500 dark:from-red-700 dark:to-red-600 | ||
transform scale-x-0 origin-left transition-transform duration-300 ease-out | ||
group-hover:scale-x-100"></span> | ||
</button> |