@props([ 'type' => 'primary', 'size' => 'md', 'tag' => 'button', 'href' => '/', 'submit' => false, 'rounded' => 'full' ]) @php $sizeClasses = match ($size) { 'sm' => 'px-2.5 py-1.5 text-xs font-medium rounded-' . $rounded, 'md' => 'px-4 py-2.5 text-sm font-medium rounded-' . $rounded, 'lg' => 'px-5 py-3 text-sm font-medium rounded-' . $rounded, 'xl' => 'px-6 py-3.5 text-base font-medium rounded-' . $rounded, '2xl' => 'px-7 py-4 text-base font-medium rounded-' . $rounded }; @endphp @php $typeClasses = match ($type) { 'primary' => '', 'secondary' => 'bg-zinc-100 border text-gray-500 hover:text-gray-700 border-zinc-100 dark:focus:ring-offset-gray-900 dark:border-gray-400/10 active:bg-white dark:focus:ring-gray-700 focus:bg-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-200/60 dark:bg-gray-800/50 dark:hover:bg-gray-800/70 dark:text-gray-400 focus:shadow-outline', 'success' => 'bg-green-600 text-white hover:bg-green-600/90 focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 focus:bg-green-700/90 focus:ring-green-700', 'info' => 'bg-blue-600 text-white hover:bg-blue-600/90 focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 focus:bg-blue-700/90 focus:ring-blue-700', 'warning' => 'bg-amber-500 text-white hover:bg-amber-500/90 focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 focus:bg-amber-600/90 focus:ring-amber-600', 'danger' => 'bg-red-600 text-white hover:bg-red-600/90 focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 focus:bg-red-700/90 focus:ring-red-700', }; $loadingTarget = $attributes['wire:target']; @endphp @php switch ($tag ?? 'button') { case 'button': $tagAttr = ($submit) ? 'button type="submit"' : 'button type="button"'; $tagClose = 'button'; break; case 'a': $link = $href ?? ''; $tagAttr = 'a href="' . $link . '"'; $tagClose = 'a'; break; default: $tagAttr = 'button type="button"'; $tagClose = 'button'; break; } @endphp <{!! $tagAttr !!} {!! $attributes->except(['class']) !!} class="@if($type == 'primary'){{ 'auth-component-button' }}@endif {{ $sizeClasses }} {{ $typeClasses }} opacity-[95%] hover:opacity-100 focus:ring-2 focus:ring-offset-2 cursor-pointer inline-flex items-center w-full justify-center disabled:opacity-50 font-semibold focus:outline-none" style="@if($type == 'primary') color:{{ config('devdojo.auth.appearance.color.button_text') }}; background-color:{{ config('devdojo.auth.appearance.color.button') }}; @endif"> {{ $slot }}