feat: allow filtering with null (no) rating
This commit is contained in:
@@ -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 },
|
||||
) => {
|
||||
|
||||
Reference in New Issue
Block a user