feat: adding source search

This commit is contained in:
Chubby Granny Chaser 2024-12-20 17:09:56 +00:00
parent 109c12064d
commit 5d5ce092b7
No known key found for this signature in database
2 changed files with 10 additions and 36 deletions

View File

@ -298,38 +298,8 @@ export default function Catalogue() {
dispatch(setSearch({ tags: [...filters.tags, value] }));
}
}}
items={[
"Action",
"Strategy",
"RPG",
"Casual",
"Racing",
"Sports",
"Indie",
"Adventure",
"Simulation",
"Massively Multiplayer",
"Free to Play",
"Accounting",
"Animation & Modeling",
"Audio Production",
"Design & Illustration",
"Education",
"Photo Editing",
"Software Training",
"Utilities",
"Video Production",
"Web Publishing",
"Game Development",
"Early Access",
"Sexual Content",
"Nudity",
"Violent",
"Gore",
"Documentary",
"Tutorial",
].map((genre) => ({
label: genre,
items={[1, 2, 3, 4, 5].map((genre) => ({
label: genre.toString(),
value: genre,
checked: filters.tags.includes(genre),
}))}

View File

@ -2,17 +2,21 @@ import { CheckboxField, TextField } from "@renderer/components";
import { useFormat } from "@renderer/hooks";
import { useCallback, useMemo, useState } from "react";
export interface FilterSectionProps {
export interface FilterSectionProps<T extends string | number> {
title: string;
items: {
label: string;
value: string;
value: T;
checked: boolean;
}[];
onSelect: (value: string) => void;
onSelect: (value: T) => void;
}
export function FilterSection({ title, items, onSelect }: FilterSectionProps) {
export function FilterSection<T extends string | number>({
title,
items,
onSelect,
}: FilterSectionProps<T>) {
const [search, setSearch] = useState("");
const filteredItems = useMemo(() => {