From b504950b593100d923cdca573370529447919346 Mon Sep 17 00:00:00 2001 From: talseku Date: Tue, 5 Nov 2024 10:38:50 -0600 Subject: [PATCH 1/2] Tag Select Behavior if this breaks everything i am so sorry --- src/components/club/directory/TagFilter.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/club/directory/TagFilter.tsx b/src/components/club/directory/TagFilter.tsx index 8401f3e8..b964ddf2 100644 --- a/src/components/club/directory/TagFilter.tsx +++ b/src/components/club/directory/TagFilter.tsx @@ -13,6 +13,8 @@ const TagFilter = ({ tags }: { tags: string[] }) => { const scrollContainerRef = useRef(null); const setSelected = (tag: string) => router.replace(`/?tag=${tag}`, { scroll: false }); + const deselect = (tag: string) => + router.replace(`/`, { scroll: false }); const handleScrollLeft = () => { const container = scrollContainerRef.current; @@ -46,7 +48,12 @@ const TagFilter = ({ tags }: { tags: string[] }) => { ? 'bg-blue-primary text-white hover:bg-blue-700' : 'bg-gray-100 text-slate-600 hover:bg-gray-200' } whitespace-nowrap rounded-3xl px-8 py-4 text-sm font-extrabold transition-colors duration-200 focus:outline-none md:text-xs`} - onClick={() => setSelected(tag)} + onClick={() => + { + selectedTag === tag + ? deselect(tag) + : setSelected(tag) + }} > {tag} From 50f44b00ea16f916a3b5ec5e002aadc17f8efb43 Mon Sep 17 00:00:00 2001 From: talseku Date: Tue, 5 Nov 2024 19:53:19 -0600 Subject: [PATCH 2/2] fix formatting --- src/components/club/directory/TagFilter.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/club/directory/TagFilter.tsx b/src/components/club/directory/TagFilter.tsx index b964ddf2..e07a3ba5 100644 --- a/src/components/club/directory/TagFilter.tsx +++ b/src/components/club/directory/TagFilter.tsx @@ -13,8 +13,7 @@ const TagFilter = ({ tags }: { tags: string[] }) => { const scrollContainerRef = useRef(null); const setSelected = (tag: string) => router.replace(`/?tag=${tag}`, { scroll: false }); - const deselect = (tag: string) => - router.replace(`/`, { scroll: false }); + const deselect = (tag: string) => router.replace(`/`, { scroll: false }); const handleScrollLeft = () => { const container = scrollContainerRef.current; @@ -48,12 +47,9 @@ const TagFilter = ({ tags }: { tags: string[] }) => { ? 'bg-blue-primary text-white hover:bg-blue-700' : 'bg-gray-100 text-slate-600 hover:bg-gray-200' } whitespace-nowrap rounded-3xl px-8 py-4 text-sm font-extrabold transition-colors duration-200 focus:outline-none md:text-xs`} - onClick={() => - { - selectedTag === tag - ? deselect(tag) - : setSelected(tag) - }} + onClick={() => { + selectedTag === tag ? deselect(tag) : setSelected(tag); + }} > {tag}