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
34
src/lib/navSections.ts
Normal file
34
src/lib/navSections.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
NAV SECTIONS: the sections listed under each page in the header's
|
||||
dropdowns, the mobile menu and the footer's site map
|
||||
|
||||
The static pages' lists are PAGE_SECTIONS in navConfig.ts. The
|
||||
front page's comes from the front page itself: the bands it is
|
||||
showing, in the admin's order, each under its heading (Front page
|
||||
→ Sections), so hiding a band or renaming it changes the menus too.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useCallback } from 'react'
|
||||
|
||||
import { PAGE_SECTIONS } from '../navConfig.ts'
|
||||
import { useFrontPage } from './useFrontPage.ts'
|
||||
import { FRONT_PAGE_BANDS, bandShows } from './frontPageBands.ts'
|
||||
|
||||
export type NavSection = { label: string; hash: string }
|
||||
|
||||
export function useNavSections(): (path: string) => NavSection[] {
|
||||
const { data: page } = useFrontPage()
|
||||
|
||||
return useCallback(
|
||||
(path: string) => {
|
||||
if (path !== '/') return PAGE_SECTIONS[path] ?? []
|
||||
if (!page) return []
|
||||
return page.sections.flatMap((section) => {
|
||||
const band = FRONT_PAGE_BANDS[section.section]
|
||||
if (!band?.id || !bandShows(page, section.section)) return []
|
||||
return [{ label: section.title || band.title, hash: `#${band.id}` }]
|
||||
})
|
||||
},
|
||||
[page],
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue