|
1 | 1 | --- |
2 | 2 | /** |
3 | | - * `TopicFilterStrip.astro` | Clickable Vendor & Topic Pills with Official Light/Dark Logos. |
4 | | - * |
5 | | - * Supports two modes: |
6 | | - * 1. In-Page Filter Mode (`basePath="/podcasts"` or `basePath="/blog"`): |
7 | | - * Filters the current listing feed in-place without losing above-the-fold context, |
8 | | - * while preserving shareable `?topic=[slug]` URLs and infinite scroll. |
9 | | - * 2. Hub Navigation Mode (default when `basePath` is omitted): |
10 | | - * Navigates directly to `/topics` and `/topic/[slug]`. |
| 3 | + * `TopicFilterStrip.astro` |
| 4 | + * Temporarily disabled pending UI/UX redesign. |
11 | 5 | */ |
12 | | -import { TOPICS } from "@/lib/topics"; |
13 | | -
|
14 | 6 | interface Props { |
15 | 7 | activeSlug?: string; |
16 | 8 | label?: string; |
17 | | - /** When set (e.g. "/podcasts" or "/blog"), pills filter the current listing page in-place. */ |
18 | 9 | basePath?: string; |
19 | 10 | allLabel?: string; |
20 | 11 | } |
21 | | -
|
22 | | -const { |
23 | | - activeSlug = "", |
24 | | - label = "Browse by Topic & Vendor:", |
25 | | - basePath, |
26 | | - allLabel = basePath ? "All" : "All Topics", |
27 | | -} = Astro.props; |
28 | | -
|
29 | | -const allHref = basePath ?? "/topics"; |
30 | 12 | --- |
31 | | - |
32 | | -<nav |
33 | | - class="my-6 flex flex-wrap items-center gap-2.5" |
34 | | - aria-label="Topics and Vendor Filter" |
35 | | - data-topic-filter-strip={basePath ? "in-page" : "hub"} |
36 | | - data-base-path={basePath} |
37 | | -> |
38 | | - <span class="mr-1 font-mono text-xs font-extrabold uppercase tracking-wider text-[#2A1155]/70 dark:text-slate-400"> |
39 | | - {label} |
40 | | - </span> |
41 | | - <a |
42 | | - href={allHref} |
43 | | - data-topic-pill={basePath ? "" : undefined} |
44 | | - data-topic-title={basePath ? allLabel : undefined} |
45 | | - aria-current={!activeSlug ? "true" : undefined} |
46 | | - class:list={[ |
47 | | - "topic-filter-pill inline-flex items-center gap-2 rounded-full border-2 border-[#2A1155] px-3.5 py-1.5 font-display text-xs font-black transition-all hover:-translate-y-0.5 shadow-sketch-sm", |
48 | | - !activeSlug |
49 | | - ? "bg-[#7C3AED] text-white dark:border-white/50" |
50 | | - : "bg-white text-[#2A1155] hover:bg-[#EDE9FE] hover:text-[#7C3AED] dark:border-white/25 dark:bg-[#131B2E] dark:text-slate-100 dark:hover:bg-purple-950/60", |
51 | | - ]} |
52 | | - > |
53 | | - <span>{allLabel}</span> |
54 | | - </a> |
55 | | - { |
56 | | - TOPICS.map((topic) => { |
57 | | - const isActive = activeSlug === topic.slug; |
58 | | - const pillHref = basePath |
59 | | - ? `${basePath}?topic=${topic.slug}` |
60 | | - : `/topic/${topic.slug}`; |
61 | | - return ( |
62 | | - <a |
63 | | - href={pillHref} |
64 | | - data-topic-pill={basePath ? topic.slug : undefined} |
65 | | - data-topic-title={basePath ? topic.title : undefined} |
66 | | - data-topic-hub={`/topic/${topic.slug}`} |
67 | | - aria-current={isActive ? "true" : undefined} |
68 | | - class:list={[ |
69 | | - "topic-filter-pill inline-flex items-center gap-2 rounded-full border-2 border-[#2A1155] px-3.5 py-1.5 font-display text-xs font-black transition-all hover:-translate-y-0.5 shadow-sketch-sm", |
70 | | - isActive |
71 | | - ? "bg-[#7C3AED] text-white dark:border-white/50" |
72 | | - : "bg-white text-[#2A1155] hover:bg-[#EDE9FE] hover:text-[#7C3AED] dark:border-white/25 dark:bg-[#131B2E] dark:text-slate-100 dark:hover:bg-purple-950/60", |
73 | | - ]} |
74 | | - > |
75 | | - {topic.symbolLight && ( |
76 | | - <img |
77 | | - src={topic.symbolLight} |
78 | | - data-src-light={topic.symbolLight} |
79 | | - data-src-dark={topic.symbolDark ?? topic.symbolLight} |
80 | | - alt="" |
81 | | - aria-hidden="true" |
82 | | - class="h-3.5 w-auto object-contain dark:hidden" |
83 | | - loading="lazy" |
84 | | - decoding="async" |
85 | | - /> |
86 | | - )} |
87 | | - {topic.symbolDark && ( |
88 | | - <img |
89 | | - src={topic.symbolDark} |
90 | | - alt="" |
91 | | - aria-hidden="true" |
92 | | - class="hidden h-3.5 w-auto object-contain dark:block" |
93 | | - loading="lazy" |
94 | | - decoding="async" |
95 | | - /> |
96 | | - )} |
97 | | - <span>{topic.title}</span> |
98 | | - </a> |
99 | | - ); |
100 | | - }) |
101 | | - } |
102 | | - { |
103 | | - basePath && ( |
104 | | - <a |
105 | | - href="/topics" |
106 | | - class="ml-auto inline-flex items-center gap-1 rounded-full border border-dashed border-[#2A1155]/40 bg-[#EDE9FE]/60 px-3 py-1 font-mono text-[11px] font-extrabold text-[#7C3AED] transition-colors hover:bg-[#EDE9FE] dark:border-purple-400/40 dark:bg-purple-950/40 dark:text-purple-200" |
107 | | - > |
108 | | - <span>Topic Hubs</span> |
109 | | - <span>→</span> |
110 | | - </a> |
111 | | - ) |
112 | | - } |
113 | | -</nav> |
0 commit comments