/** * EvidenceFormBody — the shared "citation + commentary" editor. * * One form drives both: * - the *capture* flow (creating evidence from a fresh selection * inside `InlineCaptureForm`), and * - the *edit* flow (modifying an existing evidence card inside * `EvidenceSidebar`). * * Keeping a single component means changes to the field layout, hint * placement, or save-button copy land in one file and apply to both * surfaces. Callers control the labels and any badge/helper text. */ import type { CSSProperties, ReactNode } from "react"; export interface EvidenceFormBodyProps { readonly quote: string; readonly commentary: string; onChangeQuote(next: string): void; onChangeCommentary(next: string): void; onSave(): void; onCancel(): void; /** Save-button label, defaults to "Save". */ readonly saveLabel?: string; /** Cancel-button label, defaults to "Cancel". */ readonly cancelLabel?: string; /** Short caption rendered at the top of the form, e.g. a selector * count badge or "Editing". */ readonly badge?: ReactNode; /** Inline note shown under the buttons (e.g. "won't move the * marked passage" when editing an existing item). */ readonly helper?: ReactNode; /** data-testid prefix for the input + button hooks. */ readonly testidPrefix: string; } export function EvidenceFormBody(p: EvidenceFormBodyProps) { const saveLabel = p.saveLabel ?? "Save"; const cancelLabel = p.cancelLabel ?? "Cancel"; return (