Visual - Design tokens (spacing, radius, type, motion) with a dark theme that follows prefers-color-scheme; map palette in theme.ts (exports/print stay light) - Segmented controls (language, colour scheme), switches, styled slider/select, icon buttons, cards, focus rings, hover/active states, reduced-motion support - Info panel card with animation, tooltip that stays on screen, grouped zoom buttons Map - Redraws batched per animation frame; animated zoom/fit, pan inertia, trackpad pinch, pointer cursor and outline for the hovered building - Hovering a legend row highlights that category on the map Loading & feedback - Progress bar + "Loading n/m" pill; status line with icons, collapsible basemap failure details, success messages fade - A newer load supersedes one in flight; a failed buildings query is reported immediately instead of after the basemap retries Convenience - Keyboard: +/- zoom, 0 fit, arrows pan, Esc closes - Legend All/None, double-click or Alt-click to show only one category - Settings and last location remembered; #lat,lon,radius in the URL to share, copy-link button, "my location" button - Mobile: full-screen map with a draggable bottom sheet Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
95 lines
2.2 KiB
TypeScript
95 lines
2.2 KiB
TypeScript
import type { SVGAttributes } from 'preact'
|
||
|
||
/* Small inline icon set (24×24, stroked with currentColor) – no icon font or dependency. */
|
||
const P = {
|
||
download: (
|
||
<>
|
||
<path d="M12 4v11m0 0-4.5-4.5M12 15l4.5-4.5" />
|
||
<path d="M5 20h14" />
|
||
</>
|
||
),
|
||
image: (
|
||
<>
|
||
<rect x="3" y="4" width="18" height="16" rx="2" />
|
||
<circle cx="9" cy="10" r="1.6" />
|
||
<path d="m21 16-5-5-9 9" />
|
||
</>
|
||
),
|
||
vector: (
|
||
<>
|
||
<path d="M5 19 12 5l7 14" />
|
||
<circle cx="12" cy="5" r="1.8" />
|
||
<circle cx="5" cy="19" r="1.8" />
|
||
<circle cx="19" cy="19" r="1.8" />
|
||
</>
|
||
),
|
||
table: (
|
||
<>
|
||
<rect x="3" y="4" width="18" height="16" rx="2" />
|
||
<path d="M3 10h18M3 15h18M10 4v16" />
|
||
</>
|
||
),
|
||
print: (
|
||
<>
|
||
<path d="M7 9V3h10v6" />
|
||
<rect x="3" y="9" width="18" height="8" rx="2" />
|
||
<path d="M7 14h10v7H7z" />
|
||
</>
|
||
),
|
||
locate: (
|
||
<>
|
||
<circle cx="12" cy="12" r="4" />
|
||
<path d="M12 2v3M12 19v3M2 12h3M19 12h3" />
|
||
</>
|
||
),
|
||
link: (
|
||
<>
|
||
<path d="M10 14a4.5 4.5 0 0 0 6.4 0l3-3a4.5 4.5 0 0 0-6.4-6.4L11.5 6" />
|
||
<path d="M14 10a4.5 4.5 0 0 0-6.4 0l-3 3a4.5 4.5 0 0 0 6.4 6.4l1.5-1.4" />
|
||
</>
|
||
),
|
||
plus: <path d="M12 5v14M5 12h14" />,
|
||
minus: <path d="M5 12h14" />,
|
||
fit: <path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" />,
|
||
close: <path d="m6 6 12 12M18 6 6 18" />,
|
||
chevron: <path d="m6 9 6 6 6-6" />,
|
||
check: <path d="m5 12.5 4.5 4.5L19 7" />,
|
||
alert: (
|
||
<>
|
||
<circle cx="12" cy="12" r="9" />
|
||
<path d="M12 7.5v5.5M12 16.5h.01" />
|
||
</>
|
||
),
|
||
info: (
|
||
<>
|
||
<circle cx="12" cy="12" r="9" />
|
||
<path d="M12 11v5.5M12 7.5h.01" />
|
||
</>
|
||
),
|
||
spinner: <path d="M12 3a9 9 0 1 0 9 9" />,
|
||
}
|
||
export type IconName = keyof typeof P
|
||
|
||
export function Icon({
|
||
name,
|
||
size = 16,
|
||
...rest
|
||
}: { name: IconName; size?: number } & SVGAttributes<SVGSVGElement>) {
|
||
return (
|
||
<svg
|
||
class={name === 'spinner' ? 'icon spin' : 'icon'}
|
||
width={size}
|
||
height={size}
|
||
viewBox="0 0 24 24"
|
||
fill="none"
|
||
stroke="currentColor"
|
||
stroke-width={2}
|
||
stroke-linecap="round"
|
||
stroke-linejoin="round"
|
||
aria-hidden="true"
|
||
{...rest}
|
||
>
|
||
{P[name]}
|
||
</svg>
|
||
)
|
||
}
|