import { Group, Input, TextInput } from "@mantine/core"; import type { LocalizedName } from "../types"; /** * One control for the `{am, en}` jsonb shape used across the platform. * * Kept as a single labelled unit rather than two loose fields so the pair reads * as one value, and so a validation error lands on the pair — which is how the * Zod schemas model it. */ export function BilingualTextInput({ label, value, onChange, required, error, disabled, placeholderAm = "በአማርኛ", placeholderEn = "In English", }: { label: string; value: Partial | null | undefined; onChange: (next: LocalizedName) => void; required?: boolean; error?: string; disabled?: boolean; placeholderAm?: string; placeholderEn?: string; }) { const current = { am: value?.am ?? "", en: value?.en ?? "" }; return ( onChange({ ...current, en: event.currentTarget.value }) } /> onChange({ ...current, am: event.currentTarget.value }) } /> ); }