Skip to content

Commit

Permalink
Tag Select Behavior
Browse files Browse the repository at this point in the history
if this breaks everything i am so sorry
  • Loading branch information
talseku committed Nov 5, 2024
1 parent 62d3430 commit b504950
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/club/directory/TagFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const TagFilter = ({ tags }: { tags: string[] }) => {
const scrollContainerRef = useRef<HTMLDivElement>(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;
Expand Down Expand Up @@ -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}
</button>
Expand Down

0 comments on commit b504950

Please sign in to comment.