Skip to content

Commit eacdcc3

Browse files
committed
fix(terracotta): make project filters visibly affect the archive list
- Cornerstone section now hides when any filter is active - 'Further entries' chapter head + blurb switches to 'Matched entries' with a count - Active-filter strip shows the tag/query chips with individual clears + reset
1 parent 87f3a1b commit eacdcc3

1 file changed

Lines changed: 62 additions & 8 deletions

File tree

src/pages/terracotta-views/TerracottaProjectsPage.jsx

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ const TerracottaProjectsPage = () => {
159159
);
160160
}
161161

162-
const first = filtered[0];
163-
const rest = filtered.slice(1);
162+
const isFiltering = activeTag !== 'all' || Boolean(query.trim());
163+
// Cornerstone only appears when no filter is active, so filtering always
164+
// produces a visible change — the entire list below reflects the filter.
165+
const first = isFiltering ? null : filtered[0];
166+
const rest = isFiltering ? filtered : filtered.slice(1);
164167

165168
return (
166169
<div
@@ -354,15 +357,66 @@ const TerracottaProjectsPage = () => {
354357
{/* rest — editorial list */}
355358
<section className="pt-20">
356359
<TerracottaChapter
357-
numeral="II"
358-
label="Further entries"
360+
numeral={isFiltering ? 'I' : 'II'}
361+
label={isFiltering ? 'Matched entries' : 'Further entries'}
359362
title={
360-
<>
361-
In <ChapterEm>order.</ChapterEm>
362-
</>
363+
isFiltering ? (
364+
<>
365+
By <ChapterEm>this measure.</ChapterEm>
366+
</>
367+
) : (
368+
<>
369+
In <ChapterEm>order.</ChapterEm>
370+
</>
371+
)
372+
}
373+
blurb={
374+
isFiltering
375+
? `${filtered.length} of ${(projects || []).length} entries meet the filter.`
376+
: 'Catalogued sequentially; each read on its own, each measured on the same line.'
363377
}
364-
blurb="Catalogued sequentially; each read on its own, each measured on the same line."
365378
/>
379+
{isFiltering && (
380+
<div className="flex items-center gap-3 pt-3 pb-5 font-ibm-plex-mono text-[10px] tracking-[0.22em] uppercase">
381+
<span className="text-[#2E2620]/60">Filtering</span>
382+
{activeTag !== 'all' && (
383+
<span className="inline-flex items-center gap-1.5 border border-[#C96442] bg-[#C96442]/10 text-[#9E4A2F] px-2 py-1">
384+
tag · {activeTag}
385+
<button
386+
type="button"
387+
onClick={() => setActiveTag('all')}
388+
className="hover:text-[#1A1613]"
389+
aria-label="Clear tag filter"
390+
>
391+
×
392+
</button>
393+
</span>
394+
)}
395+
{query.trim() && (
396+
<span className="inline-flex items-center gap-1.5 border border-[#1A161340] text-[#1A1613] px-2 py-1">
397+
query · “{query.trim()}
398+
<button
399+
type="button"
400+
onClick={() => setQuery('')}
401+
className="hover:text-[#9E4A2F]"
402+
aria-label="Clear search"
403+
>
404+
×
405+
</button>
406+
</span>
407+
)}
408+
<button
409+
type="button"
410+
onClick={() => {
411+
setQuery('');
412+
setActiveTag('all');
413+
}}
414+
className="ml-auto text-[#9E4A2F] hover:text-[#C96442]"
415+
>
416+
Reset →
417+
</button>
418+
</div>
419+
)}
366420
<div className="border-t border-[#1A1613]/25">
367421
<AnimatePresence mode="popLayout">
368422
{rest.map((p, i) => (

0 commit comments

Comments
 (0)