Skip to content

Verdict

The answer to "is anything wrong?" in one line, the problems named as links to where each is fixed.

<div id="v-ok" data-mount="ok"></div>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/verdict.css";

Usage

import { Verdict } from "capsomer/react/verdict";

<Verdict
  problems={problems.map((p) => ({ key: p.key, tone: p.sev, label: <Link to={p.href}>{p.title}</Link> }))}
  okNote="Sites, backups and default branches were fine on the last pass."
  more={(n) => <Link to="/needs#attention">{n} more</Link>}
/>

Examples

Problems by name, the rest as a link

<div id="v-problems" data-mount="problems"></div>

One warning

<div id="v-one" data-mount="one"></div>

Not known yet

<div id="v-unknown" data-mount="unknown"></div>

API reference

Verdict

PropTypeRequiredDoes
problemsVerdictProblem[]Yes
okLabelstringThe words when there are none: "All good".
okNoteReactNodeWhat all good means, after it: "Sites, backups and default branches were fine on the last pass."
noun[string, string]The singular and plural: ["problem", "problems"].
namednumberHow many are named; the rest are "and 4 more".
more(rest: number) => ReactNodeThe rest, as a link or button to the full list: (n) => <a href="/needs">{n} more</a>.
unknownReactNodeNo answer yet (the data has not loaded or did not come): the verdict says so, never "All good".
classNamestring

Parts and data attributes

ClassIs
.cap-verdictthe root
.cap-verdict-lista part
.cap-verdict-notea part

Accessibility

A paragraph, so it is read in order; each named problem is a real link or button. The status word carries its glyph (shape, not color alone).