import { Span } from '@hanzo/gui' import type { ReactNode } from 'react' import { paint } from '../material/paint' /** * A word about the thing it sits beside. * * Which generation a position is, whether a range is in play, that a figure is * this interface's arithmetic rather than the chain's. Each is one or two words * that qualify what they are next to, and every one of them has to survive * being read aloud in sequence with it — so a mark is text in a rule, inline, * and never an icon or a colour on its own. * * An outline rather than a fill. Three filled chips on a row read as three * buttons, and a person who tries to press the one saying "out of range" has * been told something false about what this screen does. */ /** * A colour a mark may be drawn in. * * The union rather than `string`, because the style props take a theme token * type that a literal `var(--…)` satisfies and a widened `string` does not, and * because the set is the point: a yes, a no, an unanswered question, and the * two neutral weights. A sixth colour would be a distinction with no legend. */ const SAYS = [paint.plain, paint.quiet, paint.good, paint.warn, paint.bad] as const export type Paint = (typeof SAYS)[number] /** What a mark says when it is only qualifying, not judging. */ const { quiet } = paint export function Mark({ paint = quiet, children, }: { paint?: Paint /** The word. Optional because a mark set inside a translated sentence is * handed in empty — the catalog holds the word and the runtime puts it * between these tags when it draws the sentence. */ children?: ReactNode }) { return ( // Inline, because half of these sit inside a sentence — a figure and the // word "derived" after it are one statement, and a flex box between them // would break the line and make the qualifier look like the next fact. // Left-aligned, because the other half sit inside controls that centre // their text. {children} ) }