Files
igaming-template/layouts/partials/rating-widget.html
T

22 lines
1.1 KiB
HTML

{{- /* rating-widget.html — editorial star rating. Uses page front matter
(rating / ratingCount) with a fallback to brand.yaml. */ -}}
{{- $brand := .Site.Data.brand -}}
{{- $rating := .Params.rating | default $brand.ratingValue -}}
{{- $count := .Params.ratingCount | default $brand.ratingCount -}}
{{- $rounded := int (math.Round $rating) -}}
<div class="card flex flex-wrap items-center gap-5">
<div class="text-5xl font-extrabold leading-none text-primary">
{{ $rating }}<span class="text-xl font-semibold text-secondary/40">/5</span>
</div>
<div>
<div class="flex gap-0.5" role="img" aria-label="Rated {{ $rating }} out of 5">
{{- range seq 5 -}}
<svg class="h-6 w-6 {{ if le . $rounded }}text-amber-400{{ else }}text-secondary/20{{ end }}" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path d="M12 2l2.9 6.3 6.9.7-5.1 4.7 1.4 6.8L12 17.8 5.9 20.5l1.4-6.8L2.2 9l6.9-.7L12 2z"/>
</svg>
{{- end -}}
</div>
<p class="mt-1 text-sm text-secondary/60">Independent editorial score based on {{ $count }} data points.</p>
</div>
</div>