import { CaretDown, CaretUp, Leaf } 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 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 (
{open ? (
{years.map((year) => ( ))}
) : null}
) }