Add interactive ISAC registry filters

This commit is contained in:
JB
2026-07-25 03:30:59 -04:00
parent 2910660c85
commit ddec42afd3
16 changed files with 119 additions and 41 deletions
+23
View File
@@ -0,0 +1,23 @@
<script lang="ts">
import { page } from '$app/state';
type Item = { value: string; label: string; count: string | number; description: string };
let { items, active = '', className = '' }: { items: Item[]; active?: string; className?: string } = $props();
function href(value: string) {
const params = new URLSearchParams(page.url.searchParams);
if (value) params.set('filter', value);
else params.delete('filter');
params.delete('page');
const query = params.toString();
return `${page.url.pathname}${query ? `?${query}` : ''}`;
}
</script>
<nav class={`module-kpis kpi-filters ${className}`} aria-label="Registry filters">
{#each items as item}
<a href={href(item.value)} class:active={active === item.value} aria-current={active === item.value ? 'true' : undefined}>
<span>{item.label}</span><strong>{item.count}</strong><small>{item.description}</small>
</a>
{/each}
</nav>