- Introduced AdminLTE CSS variables for color palette, body colors, card styles, and button styles. - Implemented card components with variants for primary, success, warning, danger, and info. - Added button styles including sizes and outline variants. - Created form controls, select inputs, and input groups with consistent styling. - Included utility classes for text and background colors, gradients, and shadows. - Developed components for badges, alerts, callouts, progress bars, tables, small boxes, and info boxes. - Integrated modal, dropdown, spinner, tooltip, and direct chat styles. - Established timeline and close button styles, with dark mode support for specific components.
124 lines
4.5 KiB
PHP
124 lines
4.5 KiB
PHP
{{--
|
|
Stat Card Component - AdminLTE Theme
|
|
Based on AdminLTE v4 Small Box / Info Box styling patterns
|
|
|
|
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' => '',
|
|
'variant' => null, // primary, success, warning, danger, info
|
|
'status' => null,
|
|
'statusText' => null,
|
|
'href' => null,
|
|
'progress' => null,
|
|
'progressColor' => 'primary',
|
|
'clickable' => false,
|
|
'compact' => false,
|
|
'change' => null,
|
|
'changeLabel' => null,
|
|
])
|
|
|
|
@php
|
|
$tag = $href ? 'a' : 'div';
|
|
|
|
$variantConfig = [
|
|
'primary' => ['bg' => 'bg-primary', 'class' => 'lte-bg-primary'],
|
|
'success' => ['bg' => 'bg-success', 'class' => 'lte-bg-success'],
|
|
'warning' => ['bg' => 'bg-warning', 'class' => 'lte-bg-warning'],
|
|
'danger' => ['bg' => 'bg-danger', 'class' => 'lte-bg-danger'],
|
|
'info' => ['bg' => 'bg-info', 'class' => 'lte-bg-info'],
|
|
];
|
|
|
|
$progressColors = [
|
|
'primary' => 'lte-bg-primary',
|
|
'success' => 'lte-bg-success',
|
|
'warning' => 'lte-bg-warning',
|
|
'danger' => 'lte-bg-danger',
|
|
'info' => 'lte-bg-info',
|
|
];
|
|
|
|
$statusClasses = [
|
|
'success' => 'lte-text-success',
|
|
'warning' => 'lte-text-warning',
|
|
'danger' => 'lte-text-danger',
|
|
'info' => 'lte-text-info',
|
|
'muted' => 'lte-text-muted',
|
|
];
|
|
$statusClass = $statusClasses[$status] ?? '';
|
|
$progressBarColor = $progressColors[$progressColor] ?? $progressColors['primary'];
|
|
@endphp
|
|
|
|
@if($variant)
|
|
{{-- Small Box Style (colored background) --}}
|
|
<{{ $tag }}
|
|
@if($href) href="{{ $href }}" @endif
|
|
{{ $attributes->class([
|
|
'lte-small-box lte-fade-in',
|
|
$variantConfig[$variant]['class'] ?? 'lte-bg-primary',
|
|
]) }}
|
|
>
|
|
<div class="lte-inner">
|
|
<h3>{{ $prefix }}{{ $value }}@if($suffix)<sup style="font-size: 0.6em;">{{ $suffix }}</sup>@endif</h3>
|
|
<p>{{ $label }}</p>
|
|
</div>
|
|
@if($icon)
|
|
<div class="lte-icon">
|
|
<x-dynamic-component :component="$icon" style="font-size: 70px; width: 70px; height: 70px;" />
|
|
</div>
|
|
@endif
|
|
@if($statusText)
|
|
<div class="lte-small-box-footer">
|
|
{{ $statusText }} <x-ri-arrow-right-line class="inline size-4" />
|
|
</div>
|
|
@endif
|
|
</{{ $tag }}>
|
|
@else
|
|
{{-- Info Box Style (white background with icon accent) --}}
|
|
<{{ $tag }}
|
|
@if($href) href="{{ $href }}" @endif
|
|
{{ $attributes->class([
|
|
'lte-info-box lte-fade-in',
|
|
'cursor-pointer' => $href || $clickable,
|
|
]) }}
|
|
>
|
|
@if($icon)
|
|
<span class="lte-info-box-icon lte-bg-primary rounded" style="color: #fff;">
|
|
<x-dynamic-component :component="$icon" class="size-6 {{ $iconClass }}" />
|
|
</span>
|
|
@endif
|
|
<div class="lte-info-box-content">
|
|
<span class="lte-info-box-text">{{ $label }}</span>
|
|
<span class="lte-info-box-number">
|
|
@if($prefix)<small class="lte-text-muted">{{ $prefix }}</small>@endif{{ $value }}@if($suffix)<small class="lte-text-muted">{{ $suffix }}</small>@endif
|
|
</span>
|
|
@if($change !== null || $changeLabel)
|
|
<div style="font-size: 0.8rem;" class="lte-text-muted">
|
|
@if($change !== null)
|
|
<span class="{{ $change >= 0 ? 'lte-text-success' : 'lte-text-danger' }}" style="font-weight: 600;">
|
|
{{ $change >= 0 ? '+' : '' }}{{ $change }}%
|
|
</span>
|
|
@endif
|
|
{{ $changeLabel ?? 'from last period' }}
|
|
</div>
|
|
@endif
|
|
@if($progress !== null)
|
|
<div class="lte-progress lte-progress-sm" style="margin-top: 0.5rem;">
|
|
<div class="lte-progress-bar {{ $progressBarColor }}" style="width: {{ min(100, $progress) }}%"></div>
|
|
</div>
|
|
@endif
|
|
@if($statusText)
|
|
<span class="lte-progress-description {{ $statusClass }}">{{ $statusText }}</span>
|
|
@endif
|
|
</div>
|
|
</{{ $tag }}>
|
|
@endif
|