Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/progress.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.2 KiB
PHP

{{--
Progress Bar Component - shadcn-style
Usage:
<x-proxmox::ui.progress :value="75" />
<x-proxmox::ui.progress :value="90" color="danger" showLabel />
<x-proxmox::ui.progress :value="60" color="auto" />
--}}
@props([
'value' => 0,
'max' => 100,
'color' => 'primary',
'size' => 'md',
'showLabel' => false,
'label' => null,
'gradient' => null,
'animated' => false,
'striped' => false,
])
@php
$percent = $max > 0 ? min(100, ($value / $max) * 100) : 0;
$colorClasses = [
'primary' => 'bg-primary',
'secondary' => 'bg-secondary',
'success' => 'bg-success',
'warning' => 'bg-warning',
'danger' => 'bg-danger',
'info' => 'bg-info',
];
$sizeClasses = [
'xs' => 'h-1',
'sm' => 'h-1.5',
'md' => 'h-2',
'lg' => 'h-2.5',
'xl' => 'h-3',
];
$colorClass = $colorClasses[$color] ?? $colorClasses['primary'];
$sizeClass = $sizeClasses[$size] ?? $sizeClasses['md'];
// Auto-select color based on value if specified
if ($color === 'auto') {
if ($percent >= 90) {
$colorClass = $colorClasses['danger'];
} elseif ($percent >= 70) {
$colorClass = $colorClasses['warning'];
} else {
$colorClass = $colorClasses['success'];
}
}
@endphp
<div {{ $attributes->class(['w-full']) }}>
@if($showLabel || $label)
<div class="flex items-center justify-between text-xs mb-1.5">
<span class="text-muted-foreground font-medium">{{ $label ?? 'Usage' }}</span>
<span class="font-medium">{{ number_format($percent, 1) }}%</span>
</div>
@endif
<div class="relative {{ $sizeClass }} w-full overflow-hidden rounded-full bg-primary/20">
<div
@class([
$sizeClass,
'flex-1 w-full transition-all duration-300',
$colorClass => !$gradient,
])
@if($gradient)
style="width: {{ $percent }}%; background-image: {{ $gradient }};"
@else
style="width: {{ $percent }}%;"
@endif
></div>
</div>
</div>