20 lines
516 B
TypeScript
Raw Permalink Normal View History

2023-08-02 13:11:17 +02:00
import { IconStar, IconStarFilled } from "@components/icons.tsx";
2023-07-30 19:40:39 +02:00
export const Star = (
{ max = 5, rating = 3 }: { max?: number; rating: number },
) => {
return (
<div
2023-12-08 21:17:34 +01:00
class="flex items-center gap-2 px-4 py-2 rounded-2xl bg-gray-200 z-10"
2023-07-30 19:40:39 +02:00
style={{ color: "#1F1F1F" }}
>
{Array.from({ length: max }).map((_, i) => {
2023-07-30 21:43:09 +02:00
if ((i + 1) <= rating) {
2023-07-30 19:40:39 +02:00
return <IconStarFilled class="w-4 h-4" />;
}
return <IconStar class="w-4 h-4" />;
})}
</div>
);
};