import { Leaf } from '@phosphor-icons/react' import type { CSSProperties } from 'react' import type { GroupedYear } from '../../../lib/timeline.ts' import { leafColor } from '../../../lib/color.ts' import TimelineEntry from './TimelineEntry.tsx' /** Each year is a leaf on the rail, its color turning from green to * autumn as the years go back (leafColor), its size growing with * the year's entries so the rail still reads as a density chart. * Filled, not the icon set's usual bold outline, so the color * carries. */ function leafSize(count: number): string { return `${(14 + Math.min(count, 14) * 0.9).toFixed(2)}px` } type Props = { year: GroupedYear open: boolean onToggle: (year: number) => void } export default function TimelineYear({ year, open, onToggle }: Props) { const empty = year.count === 0 const panelId = `site-tl-year-${year.year}` const className = [ 'site-tl__year', year.featured ? 'site-tl__year--featured' : '', open ? 'site-tl__year--open' : '', empty ? 'site-tl__year--empty' : '', ] .filter(Boolean) .join(' ') return (
{open ? ( empty ? (
Nothing recorded for {year.year} yet.
) : (
{year.featuredItems.length > 0 ? ( ) : null} {year.months.map((month) => (

{month.label}

    {month.items.map((item) => ( ))}
))} {year.undated.length > 0 ? (

Elsewhere in {year.year}

    {year.undated.map((item) => ( ))}
) : null}
) ) : null}
) }