Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/stat-card.blade.php
Joseph.Rawlings b4e2923a2c refactor: update Proxmox UI components to use TailAdmin styling
- Changed component styles and classes to align with TailAdmin design patterns.
- Updated color schemes, typography, and layout for consistency across components.
- Refactored Info Row, Network Address Card, Notice Banner, Progress Bar, Resource Gauge, Section Header, Server Status, Spinner, Stat Card, and Tab Panel components.
- Enhanced responsiveness and accessibility features in various components.
2025-12-17 12:33:10 -05:00

83 lines
3.0 KiB
PHP

{{--
Stat Card Component - TailAdmin style
Usage:
<x-proxmox::ui.stat-card value="12" label="CPU %" />
<x-proxmox::ui.stat-card value="8.5" suffix="GB" label="Memory" icon="ri-database-2-line" />
<x-proxmox::ui.stat-card value="3" label="Servers" status="success" statusText="All active" />
--}}
@props([
'value',
'label',
'suffix' => null,
'prefix' => null,
'icon' => null,
'iconClass' => 'text-gray-500 dark:text-gray-400',
'status' => null,
'statusText' => null,
'href' => null,
'progress' => null,
'progressColor' => 'bg-brand-500',
'clickable' => false,
'compact' => false,
'change' => null,
'changeLabel' => null,
])
@php
$tag = $href ? 'a' : 'div';
$statusClasses = [
'success' => 'text-success-500',
'warning' => 'text-warning-500',
'danger' => 'text-error-500',
'info' => 'text-blue-light-500',
'muted' => 'text-gray-500 dark:text-gray-400',
];
$statusClass = $statusClasses[$status] ?? '';
@endphp
<{{ $tag }}
@if($href) href="{{ $href }}" @endif
{{ $attributes->class([
'rounded-2xl border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-white/[0.03]',
'transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50 cursor-pointer' => $href || $clickable,
]) }}
>
<div class="flex items-center justify-between pb-2">
<span class="text-theme-sm font-medium text-gray-500 dark:text-gray-400">{{ $label }}</span>
@if($icon)
<x-dynamic-component :component="$icon" class="size-5 {{ $iconClass }}" />
@endif
</div>
<div class="mt-1">
<span @class(['font-bold text-gray-800 dark:text-white/90', 'text-2xl' => !$compact, 'text-xl' => $compact])>
@if($prefix)<span class="text-gray-500 dark:text-gray-400">{{ $prefix }}</span>@endif{{ $value }}@if($suffix)<span class="ml-1 text-base text-gray-500 dark:text-gray-400">{{ $suffix }}</span>@endif
</span>
@if($change !== null || $changeLabel)
<p class="mt-1.5 text-theme-xs text-gray-500 dark:text-gray-400">
@if($change !== null)
<span @class(['font-medium', $change >= 0 ? 'text-success-500' : 'text-error-500'])>
{{ $change >= 0 ? '+' : '' }}{{ $change }}%
</span>
@endif
{{ $changeLabel ?? 'from last period' }}
</p>
@endif
</div>
@if($progress !== null)
<div class="mt-4">
<div class="h-1.5 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700">
<div class="h-full {{ $progressColor }} rounded-full transition-all duration-200" style="width: {{ min(100, $progress) }}%"></div>
</div>
</div>
@endif
@if($statusText)
<div class="mt-4 border-t border-gray-200 pt-3 text-theme-xs font-medium dark:border-gray-800 {{ $statusClass }}">
{{ $statusText }}
</div>
@endif
</{{ $tag }}>