Skip to content

Category menu now filters the grid and scrolls down to it#12

Merged
700799 merged 3 commits into
mainfrom
claude/category-scroll-filter
May 30, 2026
Merged

Category menu now filters the grid and scrolls down to it#12
700799 merged 3 commits into
mainfrom
claude/category-scroll-filter

Conversation

@700799

@700799 700799 commented May 30, 2026

Copy link
Copy Markdown
Owner

Make the category menu filter and scroll to the books

The screenshot showed the bug: clicking a category (e.g. Power & Politics) did nothing — it still read "50 of 50" and didn't move the page. The old links used a #browse hash that neither re-applied the filter nor scrolled when you were already on the home page.

Fix

  • New CategoryNav.tsx client component replaces the static category links. Each category is now a button that:
    • On the home page — applies that theme as the active filter (via a sparky:filter-theme event) and smooth-scrolls down to the book grid, so you immediately see the filtered books.
    • On a guide page — navigates home with ?theme=<Category>.
  • BrowseSection.tsx now listens for the filter event (in addition to reading the ?theme= query param), so the grid updates instantly.
  • Added scroll-mt-24 to the #browse section so it isn't tucked under the sticky two-row header when scrolled into view.

Verify

  • npm run build succeeds (50 routes export); the PR build CI job runs it too.
  • Confirmed all 8 category buttons render on home and guide pages, and the browse section has the scroll margin.
  • Behavior: clicking a category now bounces down to the grid and shows only that category's books.

https://claude.ai/code/session_01Egnnw9v4T3ppsAQveFnijo


Generated by Claude Code

claude added 2 commits May 30, 2026 18:27
The category row links navigated with a #browse hash that neither
re-applied the filter nor scrolled when already on the home page. Replace
them with a CategoryNav client component whose buttons:
- on the home page, dispatch a filter event (BrowseSection applies the
  theme) and smooth-scroll down to the grid
- on a guide page, navigate home with ?theme=<Category>

BrowseSection now listens for the filter event in addition to reading the
query param, and #browse gets scroll-mt so it clears the sticky two-row
header when scrolled into view.
Rework the home filter box to use the full width and offer more to click:
- Three grouped, space-filling grids (Theme, Genre, Awards) instead of a
  single left-column Theme list
- One-word labels everywhere (Power, Dystopian, Pulitzer, …) with the full
  canonical name on hover (title=)
- A book count badge on every pill
- New Awards facet derived from existing book.awards (Pulitzer, Booker,
  National, Newbery, Bestseller); adds ActiveFilters.award + filterBooks
  award clause + facetOptions()/counts helpers in filters.ts
- Header category row now uses the same one-word labels with counts

Pill gains optional count badge + full-width (block) variant.
@700799 700799 marked this pull request as ready for review May 30, 2026 22:19
@700799 700799 merged commit 6d275f6 into main May 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants