- A still that fails or comes back as YouTube's 120 x 90 "no thumbnail" image gives way to the next; with none left the player is a flat teal panel with the play button showing. - Timeline: solid teal dots, a solid teal rail and teal decade tags (still on their branch), one color throughout, until a vine or tree drawing replaces them. The leaf colors are gone. - People tiles fill each row with as many as fit (2 to 10), one fewer only when the last row would be a single tile, instead of evening rows out (8 where 6 fit had come out 4 and 4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
2.1 KiB
TypeScript
70 lines
2.1 KiB
TypeScript
import { CaretDown, CaretUp } from '@phosphor-icons/react'
|
||
import { useState } from 'react'
|
||
import type { GroupedYear, SortDirection } from '../../../lib/timeline.ts'
|
||
import TimelineYear from './TimelineYear.tsx'
|
||
|
||
type Props = {
|
||
years: GroupedYear[]
|
||
count: number
|
||
direction?: SortDirection
|
||
openYears: Set<number>
|
||
onToggleYear: (year: number) => void
|
||
}
|
||
|
||
/**
|
||
* Scheduled but not yet happened. Sits above the most recent decade and
|
||
* opens upward: the toggle is first in the DOM and the list is rendered
|
||
* after it, with `flex-direction: column-reverse` flipping the visual
|
||
* order. That keeps the button anchored next to the decade marker
|
||
* instead of drifting up the page as items appear.
|
||
*
|
||
* Membership is decided by date, not by a flag, see partitionByDate.
|
||
* An event moves into the record on its own, with nothing to update.
|
||
*/
|
||
export default function TimelineUpcoming({
|
||
years,
|
||
count,
|
||
direction = 'desc',
|
||
openYears,
|
||
onToggleYear,
|
||
}: Props) {
|
||
const [open, setOpen] = useState(false)
|
||
if (count === 0) return null
|
||
|
||
return (
|
||
<section
|
||
className={`site-tl__upcoming${open ? ' site-tl__upcoming--open' : ''}`}
|
||
aria-label="Upcoming"
|
||
>
|
||
<button
|
||
type="button"
|
||
className="site-tl__upcomingBtn"
|
||
aria-expanded={open}
|
||
onClick={() => setOpen((v) => !v)}
|
||
>
|
||
<span className="site-tl__upcomingDot" aria-hidden="true" />
|
||
<span className="site-tl__upcomingLabel">
|
||
{open
|
||
? 'Hide what’s scheduled'
|
||
: `${count} ${count === 1 ? 'thing' : 'things'} still to come`}
|
||
</span>
|
||
<span className="site-tl__chevron" aria-hidden="true">
|
||
{open ? <CaretDown weight="bold" /> : <CaretUp weight="bold" />}
|
||
</span>
|
||
</button>
|
||
|
||
{open ? (
|
||
<div className="site-tl__upcomingList">
|
||
{years.map((year) => (
|
||
<TimelineYear
|
||
key={year.year}
|
||
year={year}
|
||
open={openYears.has(year.year)}
|
||
onToggle={onToggleYear}
|
||
/>
|
||
))}
|
||
</div>
|
||
) : null}
|
||
</section>
|
||
)
|
||
}
|