{# Star Rating Components ====================== Reusable star rating display and input for product reviews. Usage: {% from 'shared/macros/storefront/star-rating.html' import star_rating, rating_input, rating_summary %} #} {# Star Rating Display =================== Static star rating display. Parameters: - rating: Numeric rating value (0-5) - rating_var: Alpine.js expression for rating (dynamic) - max: Maximum stars (default: 5) - size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' (default: 'md') - show_value: Show numeric value (default: false) - show_count: Show review count (default: false) - count: Number of reviews - count_var: Alpine.js expression for count - precision: 'full' | 'half' | 'exact' (default: 'half') - color: Star color class (default: 'text-yellow-400') - empty_color: Empty star color (default: 'text-gray-300 dark:text-gray-600') Usage: {{ star_rating(rating=4.5) }} {{ star_rating(rating_var='product.rating', show_count=true, count_var='product.review_count') }} #} {% macro star_rating( rating=none, rating_var=none, max=5, size='md', show_value=false, show_count=false, count=none, count_var=none, precision='half', color='text-yellow-400', empty_color='text-gray-300 dark:text-gray-600' ) %} {% set sizes = { 'xs': 'w-3 h-3', 'sm': 'w-4 h-4', 'md': 'w-5 h-5', 'lg': 'w-6 h-6', 'xl': 'w-8 h-8' } %} {% set text_sizes = { 'xs': 'text-xs', 'sm': 'text-sm', 'md': 'text-sm', 'lg': 'text-base', 'xl': 'text-lg' } %}