mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-02 22:14:43 +01:00
25 lines
757 B
JavaScript
25 lines
757 B
JavaScript
import { Menu, Item, Form, FormRow } from 'react-basics';
|
|
import { useMessages } from 'hooks';
|
|
import styles from './FieldSelectForm.module.css';
|
|
|
|
export default function FieldSelectForm({ fields, onSelect }) {
|
|
const { formatMessage, labels } = useMessages();
|
|
|
|
return (
|
|
<Form>
|
|
<FormRow label={formatMessage(labels.fields)}>
|
|
<Menu className={styles.menu} onSelect={key => onSelect(fields[key])}>
|
|
{fields.map(({ label, name, type }, index) => {
|
|
return (
|
|
<Item key={index} className={styles.item}>
|
|
<div>{label || name}</div>
|
|
<div className={styles.type}>{type}</div>
|
|
</Item>
|
|
);
|
|
})}
|
|
</Menu>
|
|
</FormRow>
|
|
</Form>
|
|
);
|
|
}
|