{{-- resources/views/components/dashboard-widget.blade.php --}} @props([ 'title', 'value' => null, 'icon' => null, 'gradient' => 'primary', 'trend' => null, 'trendValue' => null, 'trendDirection' => 'up', 'href' => null, 'subtitle' => null, 'badge' => null, ]) @php $gradientClass = match($gradient) { 'primary' => 'gradient-primary', 'secondary' => 'gradient-secondary', 'success' => 'bg-gradient-to-r from-green-500 to-green-600', 'warning' => 'bg-gradient-to-r from-yellow-500 to-orange-600', 'danger' => 'bg-gradient-to-r from-red-500 to-red-600', 'info' => 'bg-gradient-to-r from-blue-500 to-blue-600', default => 'gradient-primary', }; $trendVariant = match($trendDirection) { 'up' => 'success', 'down' => 'danger', 'stable' => 'info', default => 'info', }; $trendIcon = match($trendDirection) { 'up' => 'trending-up', 'down' => 'trending-down', 'stable' => 'minus', default => 'minus', }; $wrapperTag = $href ? 'a' : 'div'; $wrapperAttributes = $href ? "href=\"{$href}\"" : ''; @endphp <{{ $wrapperTag }} {!! $wrapperAttributes !!} class="card hover:shadow-xl transition-all hover:-translate-y-1 {{ $href ? 'cursor-pointer' : '' }}" {{ $attributes }}>
{{ $title }}
@if($badge){{ $subtitle }}
@endif{{ $description }}
@endif{{ $description }}
{{ $time }}
{{ $slot }}{{ $description }}