import { useState } from 'react'; import { TextInput, UnstyledButton, rem, type TextInputProps, } from '@mantine/core'; export interface BilingualValue { en: string; am: string; } interface BilingualInputProps extends Omit { value: BilingualValue; onChange: (value: BilingualValue) => void; } export function BilingualInput({ label, value, onChange, required, placeholder, ...rest }: BilingualInputProps) { const [lang, setLang] = useState<'en' | 'am'>('en'); const toggle = () => setLang((l) => (l === 'en' ? 'am' : 'en')); return ( onChange({ ...value, [lang]: e.currentTarget.value })} rightSection={ {lang === 'en' ? 'EN' : 'AM'} } styles={{ input: { paddingRight: rem(42), }, }} {...rest} /> ); }