feat: allow filtering with null (no) rating

This commit is contained in:
2023-08-20 20:13:47 +02:00
parent aeb067aadb
commit 93f359e684
12 changed files with 67 additions and 36 deletions

View File

@@ -2,6 +2,27 @@ import { IconStar, IconStarFilled } from "@components/icons.tsx";
import { useSignal } from "@preact/signals";
import { useState } from "preact/hooks";
export const SmallRating = (
{ max = 5, rating }: { max?: number; rating: number },
) => {
return (
<div
class="flex gap-1 rounded"
style={{ filter: "drop-shadow(0px 3px 3px black)" }}
>
{Array.from({ length: max }).map((_, i) => {
return (
<span>
{(i + 1) <= rating
? <IconStarFilled class="w-3 h-3" />
: <IconStar class="w-3 h-3" />}
</span>
);
})}
</div>
);
};
export const Rating = (
props: { max?: number; rating: number },
) => {