Navigation: section dropdowns, a side nav, Home's sections from the front page
- The header's second strip is gone: each top link drops down its page's sections on hover or keyboard focus. - Retreats, Community, Resources, Organization and History get the admin editors' "On this page" column (SectionNav), sticky at the left from lg up, with the section being read lit. - Home's sections in the dropdown, mobile menu, footer site map, the feedback form and the QR maker are the bands the front page is showing, in its order and under its headings (navSections.ts, frontPageBands.ts, which Home.tsx now draws from too). - Resources comes before Organization in the nav and footer. - The Organization page draws from its own editor's content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
43797f38bc
commit
ed0f12022f
16 changed files with 283 additions and 237 deletions
|
|
@ -41,6 +41,7 @@ import {
|
|||
type FrontPageSection,
|
||||
type FrontPageSectionKey,
|
||||
} from '../lib/useFrontPage.ts'
|
||||
import { FRONT_PAGE_BANDS, bandShows } from '../lib/frontPageBands.ts'
|
||||
import './sections/home/home.css'
|
||||
|
||||
type BandProps = {
|
||||
|
|
@ -51,56 +52,26 @@ type BandProps = {
|
|||
position: number
|
||||
}
|
||||
|
||||
/* Default headings for a band the admin didn't title, and how each
|
||||
one renders. The ids are the page anchors, #connect is what the
|
||||
hero's second button points at out of the box. */
|
||||
const SECTIONS: Record<
|
||||
FrontPageSectionKey,
|
||||
{ title: string; render: (props: BandProps) => ReactNode }
|
||||
> = {
|
||||
countdown: {
|
||||
title: 'Next up',
|
||||
render: ({ page, position }) =>
|
||||
page.countdown && <NextEventCountdown event={page.countdown} overlap={position === 0} />,
|
||||
},
|
||||
retreats: {
|
||||
title: 'National Retreats',
|
||||
render: ({ section, title }) => (
|
||||
<RetreatsBand id="retreats" title={title} blurb={section.blurb} />
|
||||
),
|
||||
},
|
||||
calendar: {
|
||||
title: 'What’s on',
|
||||
render: ({ section, title }) => (
|
||||
<CalendarBand id="calendar" title={title} blurb={section.blurb} />
|
||||
),
|
||||
},
|
||||
stats: {
|
||||
title: 'By the numbers',
|
||||
render: ({ page, section, title }) =>
|
||||
page.stats.length > 0 && (
|
||||
<StatsBand id="numbers" title={title} blurb={section.blurb} stats={page.stats} />
|
||||
),
|
||||
},
|
||||
timeline: {
|
||||
title: 'Our story so far',
|
||||
render: ({ section, title }) => (
|
||||
<FeaturedTimelineRail id="story" title={title} blurb={section.blurb} />
|
||||
),
|
||||
},
|
||||
connect: {
|
||||
title: 'Find your way in',
|
||||
render: ({ page, section, title }) => (
|
||||
<Pathfinder id="connect" title={title} blurb={section.blurb} paths={page.paths} />
|
||||
),
|
||||
},
|
||||
featured: {
|
||||
title: 'Featured',
|
||||
render: ({ page, section, title }) =>
|
||||
page.featured.length > 0 && (
|
||||
<FeaturedBand id="featured" title={title} blurb={section.blurb} cards={page.featured} />
|
||||
),
|
||||
},
|
||||
/* How each band renders. Its anchor, its heading when the admin
|
||||
gave it none, and whether it has anything to draw are
|
||||
frontPageBands.ts's, which the nav and footer read too; #connect is
|
||||
what the hero's second button points at out of the box. */
|
||||
const id = (key: FrontPageSectionKey) => FRONT_PAGE_BANDS[key].id ?? undefined
|
||||
|
||||
const BANDS: Record<FrontPageSectionKey, (props: BandProps) => ReactNode> = {
|
||||
countdown: ({ page, position }) => <NextEventCountdown event={page.countdown!} overlap={position === 0} />,
|
||||
retreats: ({ section, title }) => <RetreatsBand id={id('retreats')!} title={title} blurb={section.blurb} />,
|
||||
calendar: ({ section, title }) => <CalendarBand id={id('calendar')!} title={title} blurb={section.blurb} />,
|
||||
stats: ({ page, section, title }) => (
|
||||
<StatsBand id={id('stats')!} title={title} blurb={section.blurb} stats={page.stats} />
|
||||
),
|
||||
timeline: ({ section, title }) => <FeaturedTimelineRail id={id('timeline')!} title={title} blurb={section.blurb} />,
|
||||
connect: ({ page, section, title }) => (
|
||||
<Pathfinder id={id('connect')!} title={title} blurb={section.blurb} paths={page.paths} />
|
||||
),
|
||||
featured: ({ page, section, title }) => (
|
||||
<FeaturedBand id={id('featured')!} title={title} blurb={section.blurb} cards={page.featured} />
|
||||
),
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
|
|
@ -138,15 +109,16 @@ export default function Home() {
|
|||
)}
|
||||
|
||||
{page?.sections.map((section, position) => {
|
||||
const band = SECTIONS[section.section]
|
||||
// A key the CHECK has gained since this file was written.
|
||||
if (!band) return null
|
||||
const render = BANDS[section.section]
|
||||
// A key the CHECK has gained since this file was written, or a
|
||||
// band with nothing to draw.
|
||||
if (!render || !bandShows(page, section.section)) return null
|
||||
return (
|
||||
<div key={section.section}>
|
||||
{band.render({
|
||||
{render({
|
||||
page,
|
||||
section,
|
||||
title: section.title || band.title,
|
||||
title: section.title || FRONT_PAGE_BANDS[section.section].title,
|
||||
position,
|
||||
})}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue