Make track cards, track links, and project filters keyboard-operable

This commit is contained in:
encie22 committed 2026-10-15 15:30:24 +10:30
1 parent b75f17e604
commit f5d2b417e6
4 files changed
+25 -12

No files matched your search

+9 -3
View File
@@ -23,12 +23,16 @@ const types = [...new Set(projects.map((project) => project.data.type))];
<SectionTitle Tag="h1">Recent Projects</SectionTitle>
<div id="filter-tokens" class="my-8 space-y-2 space-x-2">
<Token
as="button"
aria-pressed="true"
class="filter-token !text-primary ring-primary bg-white ring-2 hover:cursor-pointer"
data-type="all">All</Token
>
{
types.map((type) => (
<Token
as="button"
aria-pressed="false"
class="filter-token hover:cursor-pointer"
data-type={slugify(type)}
>
@@ -70,14 +74,15 @@ const types = [...new Set(projects.map((project) => project.data.type))];
const token = (e.target as Element).closest<HTMLElement>(".filter-token");
if (!token) return;
tokens.forEach((t) =>
tokens.forEach((t) => {
t.classList.remove(
"bg-white",
"!text-primary",
"ring-primary",
"ring-2"
)
);
);
t.setAttribute("aria-pressed", "false");
});
token.classList.add(
"bg-white",
@@ -85,6 +90,7 @@ const types = [...new Set(projects.map((project) => project.data.type))];
"ring-primary",
"ring-2"
);
token.setAttribute("aria-pressed", "true");
const type = token.dataset.type;