state-badge.tsx
This file
Path
apps/web/src/features/shared/state-badge.tsx
41 lines · 1.1 KiB · TypeScript
Last changed by
Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72
History of this fileTake it
Draw every list and subject from one row, one status line, one family fan and one set of fact blocksoscabrielbefore adoption886b726
lines 1–41why, one step back1import { Predicate } from "effect";2import type { ReactNode } from "react";34import type { MarkLook } from "./mark-look.ts";5import { Mark, STATE_MARKS } from "./marks.tsx";6import type { StateMark } from "./marks.tsx";78export interface StateBadgeProps {9 readonly mark: StateMark | MarkLook;10 readonly word?: ReactNode;11 readonly wordTone?: string;12 readonly small?: boolean;13 readonly stamp?: boolean;14 readonly className?: string;15 readonly data?: Readonly<Record<`data-${string}`, string>>;16}1718export const StateBadge = ({19 className = "",20 data,21 mark,22 small = false,23 stamp = false,24 word,25 wordTone,26}: StateBadgeProps) => {27 const look = Predicate.isString(mark) ? STATE_MARKS[mark] : mark;2829 return (30 <span31 className={`inline-flex min-w-0 items-center gap-1.5 align-middle ${className}`}32 data-mark={Predicate.isString(mark) ? mark : undefined}33 {...data}34 >35 <Mark look={look} size={small ? "sm" : "md"} stamp={stamp} />36 <span className={`min-w-0 font-medium ${wordTone ?? look.tone}`}>37 {word ?? (Predicate.isString(mark) ? STATE_MARKS[mark].word : null)}38 </span>39 </span>40 );41};