import { Menu, Item, Form, FormRow } from 'react-basics'; import { useMessages } from 'components/hooks'; import styles from './FieldSelectForm.module.css'; import { Key } from 'react'; export interface FieldSelectFormProps { fields?: any[]; onSelect?: (key: any) => void; showType?: boolean; } export default function FieldSelectForm({ fields = [], onSelect, showType = true, }: FieldSelectFormProps) { const { formatMessage, labels } = useMessages(); return (
onSelect(fields[key as any])}> {fields.map(({ name, label, type }: any, index: Key) => { return (
{label || name}
{showType && type &&
{type}
}
); })}
); }