Timeline years as leaves, green now and turning autumn going back; notices instead of dashed boxes
A year's leaf eases from green to gold to autumn between this year and 2000 (leafColor in color.ts); every year before 2000 is fully turned. Empty-section and form notes use one notice style, a flat tinted panel with a solid left bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
592e07f614
commit
d5428297a4
12 changed files with 99 additions and 66 deletions
|
|
@ -1,10 +1,16 @@
|
|||
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'
|
||||
|
||||
/** Dot diameter scales with volume, so the rail reads as a density chart. */
|
||||
function dotSize(count: number): string {
|
||||
return `${(7 + Math.min(count, 14) * 0.55).toFixed(2)}px`
|
||||
/** 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 = {
|
||||
|
|
@ -36,10 +42,12 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
|||
onClick={() => onToggle(year.year)}
|
||||
>
|
||||
<span
|
||||
className="site-tl__dot"
|
||||
style={{ '--tl-dot': dotSize(year.count) } as CSSProperties}
|
||||
className="site-tl__leaf"
|
||||
style={{ '--tl-leaf': leafSize(year.count), color: leafColor(year.year) } as CSSProperties}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
>
|
||||
<Leaf weight="fill" />
|
||||
</span>
|
||||
<span className="site-tl__yearLabel">{year.year}</span>
|
||||
<span className="site-tl__yearCount">
|
||||
{empty ? '-' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue