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,4 +1,4 @@
|
|||
import { CaretDown, CaretUp } from '@phosphor-icons/react'
|
||||
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'
|
||||
|
|
@ -42,7 +42,9 @@ export default function TimelineUpcoming({
|
|||
aria-expanded={open}
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
>
|
||||
<span className="site-tl__upcomingDot" aria-hidden="true" />
|
||||
<span className="site-tl__upcomingLeaf" aria-hidden="true">
|
||||
<Leaf weight="bold" />
|
||||
</span>
|
||||
<span className="site-tl__upcomingLabel">
|
||||
{open
|
||||
? 'Hide what’s scheduled'
|
||||
|
|
|
|||
|
|
@ -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'}`}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@
|
|||
|
||||
.site-tl__decade--pre::before {
|
||||
background: none;
|
||||
border-left: var(--tl-rail-w) dashed var(--tl-rail);
|
||||
opacity: 0.7;
|
||||
border-left: var(--tl-rail-w) solid var(--tl-rail);
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
/* Last decade fades out rather than stopping dead. */
|
||||
|
|
@ -132,7 +132,8 @@
|
|||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.375rem 0.75rem;
|
||||
border: 1px dashed var(--tl-rail);
|
||||
background: var(--color-tint-soft);
|
||||
border-left: 3px solid var(--tl-rail);
|
||||
font-size: 0.8125rem;
|
||||
color: var(--tl-faint);
|
||||
}
|
||||
|
|
@ -168,45 +169,38 @@
|
|||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Dot sits on the rail; --tl-dot is set inline from the year's item count, so
|
||||
scrolling the page gives you the organization's density at a glance. */
|
||||
.site-tl__dot {
|
||||
/* Each year's leaf sits on the rail (TimelineYear.tsx): its color
|
||||
is the year's, set inline, and --tl-leaf, its size, grows with the
|
||||
year's entries. Tilted either way in turn, like leaves on a stem. */
|
||||
.site-tl__leaf {
|
||||
position: relative;
|
||||
justify-self: start;
|
||||
margin-left: calc(var(--tl-rail-x) - (var(--tl-dot, 8px) / 2) + (var(--tl-rail-w) / 2));
|
||||
width: var(--tl-dot, 8px);
|
||||
height: var(--tl-dot, 8px);
|
||||
border-radius: 50%;
|
||||
background: var(--tl-rail);
|
||||
box-shadow: 0 0 0 4px var(--tl-surface);
|
||||
transition: background-color 140ms ease, transform 140ms ease;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
margin-left: calc(var(--tl-rail-x) - (var(--tl-leaf, 16px) / 2) + (var(--tl-rail-w) / 2));
|
||||
width: var(--tl-leaf, 16px);
|
||||
height: var(--tl-leaf, 16px);
|
||||
font-size: var(--tl-leaf, 16px);
|
||||
transform: rotate(-24deg);
|
||||
transition: transform 140ms ease;
|
||||
}
|
||||
|
||||
.site-tl__yearBtn:hover .site-tl__dot {
|
||||
background: var(--tl-accent);
|
||||
.site-tl__year:nth-child(even) .site-tl__leaf {
|
||||
transform: rotate(24deg) scaleX(-1);
|
||||
}
|
||||
|
||||
.site-tl__year--featured .site-tl__dot {
|
||||
background: var(--tl-accent);
|
||||
.site-tl__yearBtn:hover .site-tl__leaf,
|
||||
.site-tl__year--open .site-tl__leaf {
|
||||
transform: rotate(-24deg) scale(1.2);
|
||||
}
|
||||
|
||||
.site-tl__year--featured .site-tl__dot::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -5px;
|
||||
border: 1.5px solid var(--tl-accent);
|
||||
border-radius: 50%;
|
||||
opacity: 0.45;
|
||||
.site-tl__year:nth-child(even) .site-tl__yearBtn:hover .site-tl__leaf,
|
||||
.site-tl__year--open:nth-child(even) .site-tl__leaf {
|
||||
transform: rotate(24deg) scaleX(-1) scale(1.2);
|
||||
}
|
||||
|
||||
.site-tl__year--open .site-tl__dot {
|
||||
background: var(--tl-accent);
|
||||
transform: scale(1.15);
|
||||
}
|
||||
|
||||
.site-tl__decade--pre .site-tl__dot {
|
||||
background: var(--tl-surface);
|
||||
border: 1.5px solid var(--tl-rail);
|
||||
.site-tl__year--featured .site-tl__leaf {
|
||||
font-size: calc(var(--tl-leaf, 16px) * 1.3);
|
||||
}
|
||||
|
||||
.site-tl__yearLabel {
|
||||
|
|
@ -483,7 +477,8 @@ a.site-tl__entry--featured:hover {
|
|||
top: 1.25rem;
|
||||
bottom: 0;
|
||||
left: var(--tl-rail-x);
|
||||
border-left: var(--tl-rail-w) dashed var(--tl-rail);
|
||||
border-left: var(--tl-rail-w) solid var(--tl-rail);
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
.site-tl__upcomingBtn {
|
||||
|
|
@ -511,14 +506,13 @@ a.site-tl__entry--featured:hover {
|
|||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.site-tl__upcomingDot {
|
||||
.site-tl__upcomingLeaf {
|
||||
justify-self: start;
|
||||
margin-left: calc(var(--tl-rail-x) - 4px + (var(--tl-rail-w) / 2));
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
border: 1.5px dashed var(--tl-accent);
|
||||
box-shadow: 0 0 0 4px var(--tl-surface);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
margin-left: calc(var(--tl-rail-x) - 7px + (var(--tl-rail-w) / 2));
|
||||
font-size: 14px;
|
||||
color: color-mix(in oklch, #00b83d 60%, #00521b);
|
||||
}
|
||||
|
||||
.site-tl__upcomingLabel {
|
||||
|
|
@ -541,11 +535,6 @@ a.site-tl__entry--featured:hover {
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
.site-tl__upcomingList .site-tl__dot {
|
||||
background: var(--tl-surface);
|
||||
border: 1.5px dashed var(--tl-accent);
|
||||
}
|
||||
|
||||
@keyframes site-tl-rise {
|
||||
from {
|
||||
opacity: 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue