import html from 'choo/html';
export const starRating = (rating) => {
const wholeStars = Math.floor(rating);
const hasPartial = rating - wholeStars > 0;
const emptyStars = 5 - wholeStars - (hasPartial ? 1 : 0);
const stars = [];
for (let i = 0; i < wholeStars; i++) {
stars.push(html``);
}
if (hasPartial) {
stars.push(html``);
}
for (let i = 0; i < emptyStars; i++) {
stars.push(html``);
}
return stars;
}