import type { ReactNode } from "react"; import styles from "./profile-form.module.css"; /* Field helpers shared by the steps of the profile form. */ export function ErrorText({ id, children }: { id: string; children?: string | undefined }) { return children ? (

{children}

) : null; } export function Suggestion({ source, }: { source: { quote: string | null; origin: string } | null; }) { if (!source || source.origin === "manual") return null; const origin = source.origin === "imported" ? "Импортировано" : "Предложено из документа"; return (
{origin}. Значение пока не подтверждено. {source.quote ?
{source.quote}
:

Цитата не сохранена.

}
); } export type FieldProps = { id: string; label: string; error?: string | undefined; description?: ReactNode | undefined; suggestion?: { quote: string | null; origin: string } | null | undefined; children: ReactNode; }; export function Field({ id, label, error, description, suggestion, children }: FieldProps) { return (
{description ? (

{description}

) : null} {children} {suggestion ? (
) : null} {error}
); }