Private
Public Access
1
0
Files
Virtnet.bond/themes/lucentui/views/components/card/stat.blade.php

52 lines
1.9 KiB
PHP

@props([
'label',
'value',
'delta' => null,
'deltaLabel' => null,
'trend' => null,
'icon' => null,
'href' => null,
])
@php
$trendClass = match($trend) {
'up' => 'text-success',
'down' => 'text-error',
'flat' => 'text-base/60',
default => 'text-base/60',
};
$trendIcon = match($trend) {
'up' => 'ri-arrow-up-line',
'down' => 'ri-arrow-down-line',
default => null,
};
$tag = $href ? 'a' : 'div';
@endphp
<{{ $tag }} @if($href) href="{{ $href }}" wire:navigate @endif
{{ $attributes->merge(['class' => 'card-glass card-glass-hover block p-5 group']) }}>
<div class="flex items-start justify-between gap-3">
<div class="min-w-0 flex-1">
<p class="text-xs font-semibold tracking-wider uppercase text-base/60">{{ $label }}</p>
<p class="mt-2 text-3xl font-bold tnum text-base">{{ $value }}</p>
@if($delta !== null || $deltaLabel)
<div class="mt-1 flex items-center gap-1.5 text-xs {{ $trendClass }}">
@if($trendIcon)
<x-dynamic-component :component="$trendIcon" class="size-3.5" />
@endif
@if($delta !== null)<span class="font-semibold tnum">{{ $delta }}</span>@endif
@if($deltaLabel)<span class="text-base/50">{{ $deltaLabel }}</span>@endif
</div>
@endif
</div>
@if($icon)
<div class="size-10 rounded-lg bg-primary/10 text-primary flex items-center justify-center shrink-0 group-hover:bg-primary/20 transition-colors">
<x-dynamic-component :component="$icon" class="size-5" />
</div>
@endif
</div>
@isset($slot)
@if(trim($slot) !== '')
<div class="mt-4">{{ $slot }}</div>
@endif
@endisset
</{{ $tag }}>