From 761ab66d984a174a557d9caccc34b0a042f8fe9a Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Sat, 8 Jun 2024 08:48:28 +0530 Subject: [PATCH] feat: add filter and unit-based experience routing --- src/components/Exp/Tags.tsx | 10 +++---- src/index.tsx | 26 ++++++----------- src/pages/main/Exp.tsx | 31 +++++++++++---------- src/pages/main/data/experience.tsx | 11 ++++++++ src/util/useSearchParams.ts | 57 ++++++++++++++++++++++++++++++++++++++ src/util/useSet.ts | 41 --------------------------- 6 files changed, 99 insertions(+), 77 deletions(-) create mode 100644 src/util/useSearchParams.ts delete mode 100644 src/util/useSet.ts diff --git a/src/components/Exp/Tags.tsx b/src/components/Exp/Tags.tsx index d26cd71..ce185a0 100644 --- a/src/components/Exp/Tags.tsx +++ b/src/components/Exp/Tags.tsx @@ -1,6 +1,6 @@ import React from "react"; import { css, cx } from "@emotion/css"; -import { HookSet } from "../../util/useSet"; +import { HookSet } from "../../util/useSearchParams"; import { ReactComponent as Cross } from "../../assets/cross.svg"; type Tags = HookSet; @@ -32,10 +32,10 @@ export const Tag = (props: { tag: string; selected: Tags }) => { const { selected } = props; const active = selected.has(props.tag); - const select = () => - selected.has(props.tag) - ? selected.remove(props.tag) - : selected.add(props.tag); + const select = () => { + if (selected.has(props.tag)) selected.remove(props.tag); + else selected.add(props.tag); + }; return (