Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/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

124 lines
3.9 KiB
PHP

@props([
'variant' => 'neutral',
'size' => 'md',
'rounded' => 'full',
'dot' => false,
'pulse' => false,
'icon' => null,
'iconPosition' => 'left',
'removable' => false,
'outline' => false,
])
@php
// Base classes
$baseClasses = 'inline-flex items-center font-medium';
// Size classes
$sizeClasses = match($size) {
'xs' => 'px-1.5 py-0.5 text-xs gap-1',
'sm' => 'px-2 py-0.5 text-xs gap-1',
'md' => 'px-2.5 py-1 text-xs gap-1.5',
'lg' => 'px-3 py-1 text-sm gap-1.5',
default => 'px-2.5 py-1 text-xs gap-1.5',
};
// Icon size classes
$iconSizeClasses = match($size) {
'xs' => 'size-2.5',
'sm' => 'size-3',
'md' => 'size-3.5',
'lg' => 'size-4',
default => 'size-3.5',
};
// Dot size classes
$dotSizeClasses = match($size) {
'xs' => 'size-1.5',
'sm' => 'size-1.5',
'md' => 'size-2',
'lg' => 'size-2',
default => 'size-2',
};
// Variant classes
$variantClasses = match($variant) {
'success' => $outline
? 'border border-success/50 text-success bg-transparent'
: 'bg-success/10 text-success border border-success/20',
'danger' => $outline
? 'border border-danger/50 text-danger bg-transparent'
: 'bg-danger/10 text-danger border border-danger/20',
'warning' => $outline
? 'border border-warning/50 text-warning bg-transparent'
: 'bg-warning/10 text-warning border border-warning/20',
'info' => $outline
? 'border border-info/50 text-info bg-transparent'
: 'bg-info/10 text-info border border-info/20',
'primary' => $outline
? 'border border-primary/50 text-primary bg-transparent'
: 'bg-primary/10 text-primary border border-primary/20',
'secondary' => $outline
? 'border border-secondary/50 text-secondary bg-transparent'
: 'bg-secondary/10 text-secondary border border-secondary/20',
'neutral' => $outline
? 'border border-neutral/50 text-base/70 bg-transparent'
: 'bg-neutral/10 text-base/70 border border-neutral/20',
default => $outline
? 'border border-neutral/50 text-base/70 bg-transparent'
: 'bg-neutral/10 text-base/70 border border-neutral/20',
};
// Dot color classes
$dotColorClasses = match($variant) {
'success' => 'bg-success',
'danger' => 'bg-danger',
'warning' => 'bg-warning',
'info' => 'bg-info',
'primary' => 'bg-primary',
'secondary' => 'bg-secondary',
'neutral' => 'bg-base/50',
default => 'bg-base/50',
};
// Rounded classes
$roundedClasses = match($rounded) {
'none' => 'rounded-none',
'sm' => 'rounded-sm',
'md' => 'rounded-md',
'lg' => 'rounded-lg',
'full' => 'rounded-full',
default => 'rounded-full',
};
// Combined classes
$classes = "$baseClasses $sizeClasses $variantClasses $roundedClasses";
@endphp
<span {{ $attributes->merge(['class' => $classes]) }}>
{{-- Dot indicator --}}
@if($dot)
<span class="{{ $dotSizeClasses }} {{ $dotColorClasses }} rounded-full {{ $pulse ? 'animate-pulse' : '' }}"></span>
@endif
{{-- Left icon --}}
@if($icon && $iconPosition === 'left')
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
@endif
{{-- Content --}}
{{ $slot }}
{{-- Right icon --}}
@if($icon && $iconPosition === 'right')
<x-dynamic-component :component="$icon" class="{{ $iconSizeClasses }}" />
@endif
{{-- Remove button --}}
@if($removable)
<button type="button" class="ml-1 -mr-1 hover:opacity-70 transition-opacity">
<x-ri-close-line class="{{ $iconSizeClasses }}" />
</button>
@endif
</span>