@props([ 'filled' => 0, 'max' => 6, 'animate' => false, 'size' => 'sm', 'layout' => 'row', ]) @php $filled = max(0, min((int) $filled, (int) $max)); $max = max(1, (int) $max); $sizeClass = match($size) { 'lg' => 'tv-star-lg', 'md' => 'tv-star-md', 'celebration' => 'tv-star-celebration', default => 'tv-star-sm', }; $layoutClass = $layout === 'arc' ? 'tv-star-rating--arc' : 'tv-star-rating--row'; @endphp
merge(['class' => "tv-star-rating {$sizeClass} {$layoutClass}" . ($animate ? ' tv-star-rating--animate' : '')]) }}> @for ($i = 1; $i <= $max; $i++) @php $arcStyle = $layout === 'arc' ? '--arc-index: ' . ($i - 1) . '; animation-delay: ' . (($i - 1) * 100) . 'ms;' : ($animate ? 'animation-delay: ' . (($i - 1) * 80) . 'ms;' : ''); @endphp $i <= $filled, 'far fa-star tv-star tv-star--empty' => $i > $filled, ]) style="{{ $arcStyle }}"> @endfor