@props([ 'icon' => 'squares-2x2', 'title' => '', 'value' => 0, 'trend' => null, // numeric percentage, e.g. 12 or -4 'color' => 'green', // see $palette below 'link' => null, ]) {{-- StatCard (component.md). Colour classes are written as literal strings in $palette so Tailwind's content scanner keeps them in the build. --}} @php $palette = [ 'green' => ['bg' => 'bg-green-100 dark:bg-green-900/30', 'text' => 'text-green-600 dark:text-green-400'], 'blue' => ['bg' => 'bg-blue-100 dark:bg-blue-900/30', 'text' => 'text-blue-600 dark:text-blue-400'], 'purple' => ['bg' => 'bg-purple-100 dark:bg-purple-900/30', 'text' => 'text-purple-600 dark:text-purple-400'], 'pink' => ['bg' => 'bg-pink-100 dark:bg-pink-900/30', 'text' => 'text-pink-600 dark:text-pink-400'], 'indigo' => ['bg' => 'bg-indigo-100 dark:bg-indigo-900/30', 'text' => 'text-indigo-600 dark:text-indigo-400'], 'yellow' => ['bg' => 'bg-yellow-100 dark:bg-yellow-900/30', 'text' => 'text-yellow-600 dark:text-yellow-400'], 'orange' => ['bg' => 'bg-orange-100 dark:bg-orange-900/30', 'text' => 'text-orange-600 dark:text-orange-400'], 'teal' => ['bg' => 'bg-teal-100 dark:bg-teal-900/30', 'text' => 'text-teal-600 dark:text-teal-400'], ]; $c = $palette[$color] ?? $palette['green']; $tag = $link ? 'a' : 'div'; @endphp <{{ $tag }} @if ($link) href="{{ $link }}" @endif {{ $attributes->merge(['class' => 'card-interactive group block animate-fade-in']) }}>

{{ $title }}

{{ $value }}

@if (! is_null($trend)) {{ $trend >= 0 ? '↑' : '↓' }} {{ abs($trend) }}% vs kemarin @endif