Rotating words: {Next|Now} in titles and text cycles through its choices
Migration 084: site defaults for the motion (slide, flip, fade, type, mirror), direction and seconds per word in Site settings, and a hero's and a block's own. The hero's headline, section and band titles, headings, paragraphs, callouts and quotes rotate; menus, tab titles, search text and emails show the first word; less motion shows it still. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ab8dcdd608
commit
a10ff6d75f
30 changed files with 411 additions and 37 deletions
|
|
@ -44,6 +44,7 @@ import CommunityBlog from './sections/CommunityBlog.tsx'
|
|||
import HistoryTimeline from './sections/history/HistoryTimeline.tsx'
|
||||
import { DirectoryTabs, DIRECTORY_PREVIEW } from './sections/PeopleDirectory.tsx'
|
||||
import { DataRequestSection, FeedbackSection, GivingSection, QrSection, RequestSection } from './sections/FormSections.tsx'
|
||||
import { Words } from '../components/RotatingWords.tsx'
|
||||
|
||||
/* Year the program starts: decades ending before it get the
|
||||
pre-program look on the timeline. */
|
||||
|
|
@ -235,7 +236,9 @@ function PlainBand({ section }: { section: SitePageSection }) {
|
|||
return (
|
||||
<section id={section.anchor} className="py-24">
|
||||
<div className="mx-auto mb-12 max-w-6xl px-6">
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">{section.title}</h2>
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
|
||||
<Words text={section.title} />
|
||||
</h2>
|
||||
{section.blurb && <p className="mt-3 max-w-xl text-lg text-muted">{section.blurb}</p>}
|
||||
</div>
|
||||
<SectionBody
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
import EventCalendar from '../EventCalendar.tsx'
|
||||
import RequestLink from '../../../components/RequestLink.tsx'
|
||||
import { Words } from '../../../components/RotatingWords.tsx'
|
||||
|
||||
type CalendarBandProps = { id: string; title: string; blurb?: string | null }
|
||||
|
||||
|
|
@ -19,7 +20,7 @@ export default function CalendarBand({ id, title, blurb }: CalendarBandProps) {
|
|||
<div className="mx-auto mb-10 flex max-w-6xl flex-wrap items-end justify-between gap-4 px-6">
|
||||
<div>
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
|
||||
{title}
|
||||
<Words text={title} />
|
||||
</h2>
|
||||
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
import FeaturedCards from '../../../components/FeaturedCards.tsx'
|
||||
import type { FeaturedCard, FeaturedColumns } from '../../../lib/sectionTypes.ts'
|
||||
import { Words } from '../../../components/RotatingWords.tsx'
|
||||
|
||||
type FeaturedBandProps = {
|
||||
id: string
|
||||
|
|
@ -22,7 +23,7 @@ export default function FeaturedBand({ id, title, blurb, cards, columns }: Featu
|
|||
return (
|
||||
<section id={id} className="py-24">
|
||||
<div className="mx-auto max-w-6xl px-6">
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">{title}</h2>
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl"><Words text={title} /></h2>
|
||||
{blurb && <p className="mt-4 max-w-2xl text-lg text-muted">{blurb}</p>}
|
||||
<div className="mt-12">
|
||||
<FeaturedCards cards={cards} columns={columns ?? undefined} />
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import { MONTH_LABELS, type TimelineItem } from '../../../lib/timeline.ts'
|
|||
import { accentText, BRAND } from '../../../lib/color.ts'
|
||||
import { scrollBehavior } from '../../../lib/motion.ts';
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
import { Words } from '../../../components/RotatingWords.tsx'
|
||||
|
||||
const DRAG_SLOP = 6
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
|||
if (reading) {
|
||||
return (
|
||||
<section id={id}>
|
||||
<h2>{title}</h2>
|
||||
<h2><Words text={title} /></h2>
|
||||
{blurb && <p>{blurb}</p>}
|
||||
{error ? (
|
||||
<p>Couldn’t load the timeline. {error}</p>
|
||||
|
|
@ -104,7 +105,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
|||
<div className="mx-auto flex max-w-6xl flex-wrap items-end gap-6 px-6">
|
||||
<div>
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">
|
||||
{title}
|
||||
<Words text={title} />
|
||||
</h2>
|
||||
{blurb && <p className="mt-3 max-w-xl text-lg text-muted">{blurb}</p>}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ import { useReadingMode } from '../../../lib/readingMode.ts'
|
|||
import { eventHref } from '../../../lib/hrefs.ts'
|
||||
import { seriesLabel } from '../../../lib/eventSeries.ts'
|
||||
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/sectionTypes.ts'
|
||||
import { WordMotion, Words as RotatingText } from '../../../components/RotatingWords.tsx'
|
||||
import { firstWords } from '../../../lib/words.ts'
|
||||
|
||||
const DEEP = '#001011'
|
||||
|
||||
|
|
@ -187,7 +189,9 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
|||
} [overflow-wrap:anywhere]`}
|
||||
style={{ animationDelay: '60ms' }}
|
||||
>
|
||||
{hero.headline}
|
||||
<WordMotion settings={hero.words}>
|
||||
<RotatingText text={hero.headline} />
|
||||
</WordMotion>
|
||||
</h1>
|
||||
|
||||
{hero.subhead && (
|
||||
|
|
@ -226,7 +230,7 @@ function ReadingHero({ hero, feature, slides, video }: ReadingHeroProps) {
|
|||
return (
|
||||
<>
|
||||
{feature === 'none' && hero.eyebrow && <p>{hero.eyebrow}</p>}
|
||||
<h1>{hero.headline}</h1>
|
||||
<h1>{firstWords(hero.headline)}</h1>
|
||||
{hero.subhead && <p>{hero.subhead}</p>}
|
||||
{[hero.primary, hero.secondary].map(
|
||||
(button) =>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import HomeLink, { isExternal } from './HomeLink.tsx'
|
|||
import type { SectionPath } from '../../../lib/sectionTypes.ts'
|
||||
import { ACCENTS, accentText, readableOn } from '../../../lib/color.ts'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
import { Words } from '../../../components/RotatingWords.tsx'
|
||||
import { firstWords } from '../../../lib/words.ts'
|
||||
|
||||
type PathfinderProps = {
|
||||
id: string
|
||||
|
|
@ -80,7 +82,7 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
|||
if (reading) {
|
||||
return (
|
||||
<section id={id}>
|
||||
<h2>{title}</h2>
|
||||
<h2><Words text={title} /></h2>
|
||||
{blurb && <p>{blurb}</p>}
|
||||
{paths.map((option, index) => (
|
||||
<div key={`${option.label}-${index}`}>
|
||||
|
|
@ -131,14 +133,14 @@ export default function Pathfinder({ id, title, blurb, paths }: PathfinderProps)
|
|||
return (
|
||||
<section id={id} className="py-24">
|
||||
<div className="mx-auto max-w-6xl px-6">
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl">{title}</h2>
|
||||
<h2 className="font-display text-4xl font-bold text-ink md:text-5xl"><Words text={title} /></h2>
|
||||
{blurb && <p className="mt-4 max-w-2xl text-lg text-muted">{blurb}</p>}
|
||||
|
||||
<div className="mt-12 overflow-hidden shadow-md">
|
||||
<div className="-mr-[4px] -mb-[4px]">
|
||||
<div
|
||||
role="tablist"
|
||||
aria-label={title}
|
||||
aria-label={firstWords(title)}
|
||||
aria-orientation="horizontal"
|
||||
className="grid sm:grid-cols-2 lg:grid-cols-[repeat(var(--paths),minmax(0,1fr))]"
|
||||
style={{ '--paths': Math.min(paths.length, 5) } as CSSProperties}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import { useEffect, useRef, useState } from 'react'
|
|||
import type { SectionStat } from '../../../lib/sectionTypes.ts'
|
||||
import { prefersLessMotion } from '../../../lib/motion.ts'
|
||||
import { useReadingMode } from '../../../lib/readingMode.ts'
|
||||
import { Words } from '../../../components/RotatingWords.tsx'
|
||||
|
||||
const COUNT_MS = 1400
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
|||
if (useReadingMode()) {
|
||||
return (
|
||||
<section id={id}>
|
||||
<h2>{title}</h2>
|
||||
<h2><Words text={title} /></h2>
|
||||
{blurb && <p>{blurb}</p>}
|
||||
<ul>
|
||||
{stats.map((stat, index) => (
|
||||
|
|
@ -74,7 +75,7 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
|||
>
|
||||
<div className="relative mx-auto max-w-6xl px-6">
|
||||
<h2 className="font-display text-3xl font-bold text-white md:text-4xl">
|
||||
{title}
|
||||
<Words text={title} />
|
||||
</h2>
|
||||
{blurb && <p className="mt-3 max-w-2xl text-white/70">{blurb}</p>}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue