mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-27 14:21:00 +00:00
Copied verbatim from the pre-override branch so the approved screens are recoverable at this exact commit before any wiring changes them. Brings back the richer flows the client signed off: a four-step seafarer registration wizard with bilingual inputs and an Ethiopic date picker, the vessel-owner portal (its own register/login/dashboard), ownership transfer, and the seaman book, certificate, medical and endorsement screens. Six of these pages already call an API; ten are mockups carrying hardcoded data. Both are committed as-is here -- the wiring that follows is a separate commit so the diff shows exactly what changed from what the client approved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
import { useState } from 'react';
|
|
import {
|
|
TextInput,
|
|
UnstyledButton,
|
|
rem,
|
|
type TextInputProps,
|
|
} from '@mantine/core';
|
|
|
|
export interface BilingualValue {
|
|
en: string;
|
|
am: string;
|
|
}
|
|
|
|
interface BilingualInputProps
|
|
extends Omit<TextInputProps, 'value' | 'onChange' | 'rightSection' | 'rightSectionWidth'> {
|
|
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 (
|
|
<TextInput
|
|
label={label}
|
|
required={required}
|
|
placeholder={placeholder ?? (lang === 'en' ? 'Enter in English' : 'በአማርኛ ያስገቡ')}
|
|
value={value[lang]}
|
|
onChange={(e) => onChange({ ...value, [lang]: e.currentTarget.value })}
|
|
rightSection={
|
|
<UnstyledButton
|
|
onClick={toggle}
|
|
aria-label={`Switch to ${lang === 'en' ? 'Amharic' : 'English'}`}
|
|
style={{
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
width: rem(28),
|
|
height: rem(20),
|
|
borderRadius: rem(4),
|
|
fontSize: rem(10),
|
|
fontWeight: 700,
|
|
letterSpacing: '0.05em',
|
|
background:
|
|
lang === 'en'
|
|
? 'var(--mantine-color-blue-1)'
|
|
: 'var(--mantine-color-teal-1)',
|
|
color:
|
|
lang === 'en'
|
|
? 'var(--mantine-color-blue-7)'
|
|
: 'var(--mantine-color-teal-7)',
|
|
cursor: 'pointer',
|
|
transition: 'background 150ms ease',
|
|
}}
|
|
>
|
|
{lang === 'en' ? 'EN' : 'AM'}
|
|
</UnstyledButton>
|
|
}
|
|
styles={{
|
|
input: {
|
|
paddingRight: rem(42),
|
|
},
|
|
}}
|
|
{...rest}
|
|
/>
|
|
);
|
|
}
|