@props([
    'href' => null,
    'type' => 'button',
])

@php
    $isDisabled = $attributes->has('disabled');
    $base = 'btn-press inline-flex items-center justify-center rounded-full bg-emerald-600 px-6 py-2 text-xs font-semibold text-white transition hover:bg-emerald-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-70 disabled:hover:bg-emerald-600 aria-disabled:pointer-events-none aria-disabled:opacity-70 sm:px-10 sm:py-3 sm:text-sm';
@endphp

@if ($href)
    <a href="{{ $href }}" {{ $attributes->except('disabled')->merge(['class' => $base]) }} @if ($isDisabled) aria-disabled="true" tabindex="-1" @endif>
        {{ $slot }}
    </a>
@else
    <button type="{{ $type }}" {{ $attributes->merge(['class' => $base]) }}>
        {{ $slot }}
    </button>
@endif
