Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jup 101 tag unselect #260

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/club/directory/TagFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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 +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}
</button>
Expand Down