app/components/writing/status-label.tsx
23 lines and 1 functions in DrDustinEdwards/carrel, at commit d5d5e82 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| StatusLabelPill | 9 to 26 | 3 | 0% | WatchCRAP 12 | No data: mutation testing has not run on this repo yet |
Imports
It imports app/lib/writing/status.ts. Imported by app/routes/book.corkboard.tsx, app/routes/book.outliner.tsx, app/routes/book.tsx.
Source
// A file's status as the project's list names it: the label's word with its color as a dot beside
// it, so the word carries the meaning and the color only repeats it. A value the list does not carry
// is shown as written, in a neutral outline pill; an empty one shows nothing.
import { Pill } from "capsomer/react/status";
import { labelFor, type StatusLabel } from "~/lib/writing/status";
export function StatusLabelPill({ labels, status }: { labels: StatusLabel[]; status: string }) {
if (!status.trim()) return null;
const label = labelFor(labels, status);
if (!label) {
return (
<Pill variant="outline">
{status.trim()}
<span className="cap-sr-only"> (not on the status list)</span>
</Pill>
);
}
return (
<span className="app-label" data-color={label.color}>
<span className="app-label-dot" aria-hidden="true" />
{label.label}
</span>
);
}