feat: add star rating macro
This commit is contained in:
parent
251ffdf1c4
commit
41b79ba54d
5 changed files with 31 additions and 0 deletions
12
src/_includes/macros/utils.njk
Normal file
12
src/_includes/macros/utils.njk
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% macro stars(number) %}
|
||||
{% set filledStars = number %}
|
||||
{% set emptyStars = 5 - number %}
|
||||
<ul class="[ stars ] [ flex list-none p-0 text-primary ]" aria-description="{{ number }} out of 5 stars">
|
||||
{% for i in range(0, filledStars) %}
|
||||
<li>{% include "svgs/star.svg" %}</li>
|
||||
{% endfor %}
|
||||
{% for i in range(0, emptyStars) %}
|
||||
<li>{% include "svgs/star-empty.svg" %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
Loading…
Add table
Add a link
Reference in a new issue