Modularize UI, make it a bit more Lisp independent

This commit is contained in:
Yura Dupyn 2026-04-25 16:20:25 +02:00
parent e1e1b90579
commit c3edf193c4
19 changed files with 973 additions and 884 deletions

21
src/ui/SpanChip.tsx Normal file
View file

@ -0,0 +1,21 @@
import type { CodePointSpan } from 'source-region';
import { spanLabel } from './format';
import type { HoverTarget } from './types';
export function SpanChip(props: {
label: string;
span: CodePointSpan;
onHover: (target: HoverTarget | undefined) => void;
}) {
return (
<button
class="span-chip"
type="button"
onMouseEnter={() => props.onHover({ label: props.label, span: props.span })}
onMouseLeave={() => props.onHover(undefined)}
>
<span>{props.label}</span>
<span>{spanLabel(props.span)}</span>
</button>
);
}