Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/badge.blade.php
Joseph.Rawlings e7b33a2f6c Refactor Proxmox server views for improved UI consistency and usability
- Updated server card component to use new UI elements and improved layout.
- Enhanced status display with badges and better status indicators.
- Refined quick info row for server details with consistent styling.
- Reorganized server configuration statistics into stat cards for clarity.
- Improved help modals for statistics and storage management sections.
- Streamlined alerts and warnings for better user experience.
- Updated storage management view to utilize new UI components and improve readability.
2025-12-17 11:24:17 -05:00

79 lines
2.8 KiB
PHP

{{--
Badge Component - TailServer 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 font-semibold rounded-full transition-colors';
$variantClasses = [
'default' => $outline ? 'bg-transparent border border-neutral/30 text-base/70' : 'bg-neutral/10 text-base/70',
'primary' => $outline ? 'bg-transparent border border-primary/40 text-primary' : 'bg-primary/10 text-primary',
'secondary' => $outline ? 'bg-transparent border border-secondary/40 text-secondary' : 'bg-secondary/10 text-secondary',
'success' => $outline ? 'bg-transparent border border-success/40 text-success' : 'bg-success/10 text-success',
'warning' => $outline ? 'bg-transparent border border-warning/40 text-warning' : 'bg-warning/10 text-warning',
'danger' => $outline ? 'bg-transparent border border-danger/40 text-danger' : 'bg-danger/10 text-danger',
'info' => $outline ? 'bg-transparent border border-info/40 text-info' : 'bg-info/10 text-info',
'muted' => 'bg-neutral/5 text-base/40',
];
$sizeClasses = [
'xs' => 'px-1.5 py-0.5 text-[10px] leading-tight',
'sm' => 'px-2 py-0.5 text-[11px] leading-tight',
'md' => 'px-2.5 py-1 text-xs',
'lg' => 'px-3 py-1.5 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.5' => $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="{{ $iconSize }} opacity-80" />
@endif
{{ $slot }}
</span>