- Changed badge, button, card, dropdown, input, modal, select, table, tabs, toggle, and tooltip components to align with the TailAdmin design system. - Updated class names and styles for consistency across components. - Enhanced accessibility and responsiveness in various components. - Improved hover and focus states for better user experience.
79 lines
3.1 KiB
PHP
79 lines
3.1 KiB
PHP
{{--
|
|
Badge Component - TailAdmin Theme
|
|
|
|
Usage:
|
|
<x-proxmox::ui.badge>Default</x-proxmox::ui.badge>
|
|
<x-proxmox::ui.badge variant="success">Running</x-proxmox::ui.badge>
|
|
<x-proxmox::ui.badge variant="danger" icon="ri-error-warning-line">Error</x-proxmox::ui.badge>
|
|
<x-proxmox::ui.badge variant="info" dot pulse>Active</x-proxmox::ui.badge>
|
|
--}}
|
|
|
|
@props([
|
|
'variant' => 'default',
|
|
'size' => 'md',
|
|
'icon' => null,
|
|
'dot' => false,
|
|
'pulse' => false,
|
|
'outline' => false,
|
|
])
|
|
|
|
@php
|
|
$baseClasses = 'inline-flex items-center rounded-full font-medium transition-colors';
|
|
|
|
$variantClasses = [
|
|
'default' => 'bg-brand-50 text-brand-500 dark:bg-brand-500/15 dark:text-brand-400',
|
|
'secondary' => 'bg-gray-100 text-gray-700 dark:bg-white/5 dark:text-white/80',
|
|
'success' => $outline ? 'ring-1 ring-success-500/40 text-success-600 bg-transparent dark:text-success-400' : 'bg-success-50 text-success-600 dark:bg-success-500/15 dark:text-success-400',
|
|
'warning' => $outline ? 'ring-1 ring-warning-500/40 text-warning-600 bg-transparent dark:text-orange-400' : 'bg-warning-50 text-warning-600 dark:bg-warning-500/15 dark:text-orange-400',
|
|
'danger' => $outline ? 'ring-1 ring-error-500/40 text-error-600 bg-transparent dark:text-error-400' : 'bg-error-50 text-error-600 dark:bg-error-500/15 dark:text-error-400',
|
|
'info' => $outline ? 'ring-1 ring-blue-light-500/40 text-blue-light-600 bg-transparent dark:text-blue-light-400' : 'bg-blue-light-50 text-blue-light-500 dark:bg-blue-light-500/15 dark:text-blue-light-500',
|
|
'outline' => 'text-gray-700 ring-1 ring-gray-300 dark:text-gray-400 dark:ring-gray-700',
|
|
'muted' => 'bg-gray-500 text-white dark:bg-white/5 dark:text-white/80',
|
|
];
|
|
|
|
$sizeClasses = [
|
|
'xs' => 'px-2 py-0.5 text-[10px]',
|
|
'sm' => 'px-2 py-0.5 text-xs',
|
|
'md' => 'px-2.5 py-0.5 text-sm',
|
|
'lg' => 'px-3 py-1 text-sm',
|
|
];
|
|
|
|
$iconSizes = [
|
|
'xs' => 'size-2.5',
|
|
'sm' => 'size-3',
|
|
'md' => 'size-3.5',
|
|
'lg' => 'size-4',
|
|
];
|
|
|
|
$dotSizes = [
|
|
'xs' => 'size-1',
|
|
'sm' => 'size-1.5',
|
|
'md' => 'size-1.5',
|
|
'lg' => 'size-2',
|
|
];
|
|
|
|
$classes = collect([
|
|
$baseClasses,
|
|
$variantClasses[$variant] ?? $variantClasses['default'],
|
|
$sizeClasses[$size] ?? $sizeClasses['md'],
|
|
])->filter()->join(' ');
|
|
|
|
$iconSize = $iconSizes[$size] ?? $iconSizes['md'];
|
|
$dotSize = $dotSizes[$size] ?? $dotSizes['md'];
|
|
@endphp
|
|
|
|
<span {{ $attributes->class([$classes, 'gap-1' => $icon || $dot]) }}>
|
|
@if($dot)
|
|
<span class="relative flex {{ $dotSize }}">
|
|
@if($pulse)
|
|
<span class="absolute inline-flex h-full w-full rounded-full bg-current opacity-40 animate-ping"></span>
|
|
@endif
|
|
<span class="relative inline-flex rounded-full {{ $dotSize }} bg-current"></span>
|
|
</span>
|
|
@endif
|
|
@if($icon)
|
|
<x-dynamic-component :component="$icon" class="fill-current {{ $iconSize }}" />
|
|
@endif
|
|
{{ $slot }}
|
|
</span>
|