diff --git a/src/components/club/directory/TagFilter.tsx b/src/components/club/directory/TagFilter.tsx index 8401f3e8..e07a3ba5 100644 --- a/src/components/club/directory/TagFilter.tsx +++ b/src/components/club/directory/TagFilter.tsx @@ -13,6 +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 handleScrollLeft = () => { const container = scrollContainerRef.current; @@ -46,7 +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={() => setSelected(tag)} + onClick={() => { + selectedTag === tag ? deselect(tag) : setSelected(tag); + }} > {tag}