Files
newznab-tmux-NNTmux/resources/views/components/admin/button.blade.php
T
2026-08-28 00:59:02 +02:00

36 lines
1.5 KiB
PHP

@props([
'href' => null,
'type' => 'button',
'tone' => 'primary',
'icon' => null,
])
@php
$classes = [
'danger' => 'bg-red-600 text-white hover:bg-red-700 focus:ring-red-500',
'ghost' => 'bg-transparent text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700 focus:ring-gray-400',
'gray' => 'bg-gray-200 text-gray-800 hover:bg-gray-300 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600 focus:ring-gray-400',
'primary' => 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500',
'success' => 'bg-green-600 text-white hover:bg-green-700 focus:ring-green-500',
'warning' => 'bg-yellow-600 text-white hover:bg-yellow-700 focus:ring-yellow-500',
][$tone] ?? 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500';
$base = 'inline-flex min-h-11 items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold shadow-sm transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-900 '.$classes;
@endphp
@if($href)
<a href="{{ $href }}" {{ $attributes->merge(['class' => $base]) }}>
@if($icon)
<i class="{{ $icon }}" aria-hidden="true"></i>
@endif
{{ $slot }}
</a>
@else
<button type="{{ $type }}" {{ $attributes->merge(['class' => $base]) }}>
@if($icon)
<i class="{{ $icon }}" aria-hidden="true"></i>
@endif
{{ $slot }}
</button>
@endif