Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/badge.blade.php
Joseph.Rawlings 7190d7a818 refactor: update UI components to shadcn-style
- Refactored select component to align with shadcn design principles.
- Updated server status indicator component for consistency with shadcn style.
- Modified spinner component to follow shadcn design guidelines.
- Enhanced stat card component with shadcn-inspired styles.
- Adjusted tab panel component to reflect shadcn design updates.
- Revamped table row and table data cell components to match shadcn aesthetics.
- Updated table header cell component for improved styling consistency.
- Refined table component to align with shadcn design principles.
- Enhanced tabs component with shadcn-inspired styles.
- Updated toggle component to follow shadcn design guidelines.
- Refactored tooltip component to align with shadcn design principles.
- Updated server card component to reflect shadcn-inspired design.
2025-12-17 11:47:42 -05:00

79 lines
2.8 KiB
PHP

{{--
Badge Component - TailServer Theme (shadcn-inspired)
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-md border font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2';
$variantClasses = [
'default' => 'border-transparent bg-primary text-primary-foreground shadow',
'secondary' => 'border-transparent bg-secondary text-secondary-foreground',
'success' => $outline ? 'border-success/40 text-success bg-transparent' : 'border-transparent bg-success/15 text-success',
'warning' => $outline ? 'border-warning/40 text-warning bg-transparent' : 'border-transparent bg-warning/15 text-warning',
'danger' => $outline ? 'border-danger/40 text-danger bg-transparent' : 'border-transparent bg-danger/15 text-danger',
'info' => $outline ? 'border-info/40 text-info bg-transparent' : 'border-transparent bg-info/15 text-info',
'outline' => 'text-foreground border-neutral/20',
'muted' => 'border-transparent bg-muted text-muted-foreground',
];
$sizeClasses = [
'xs' => 'px-1.5 py-0.5 text-[10px]',
'sm' => 'px-2 py-0.5 text-[11px]',
'md' => 'px-2.5 py-0.5 text-xs',
'lg' => 'px-3 py-1 text-sm',
];
$iconSizes = [
'xs' => 'size-2.5',
'sm' => 'size-3',
'md' => 'size-3',
'lg' => 'size-3.5',
];
$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="{{ $iconSize }}" />
@endif
{{ $slot }}
</span>