2023-01-28 06:53:13 +01:00
|
|
|
import { Button, Icon, Text, Modal, Icons, ModalTrigger } from 'react-basics';
|
2023-01-24 00:32:35 +01:00
|
|
|
import UserAddForm from './UserAddForm';
|
2023-03-22 22:05:55 +01:00
|
|
|
import useMessages from 'hooks/useMessages';
|
2023-01-21 02:12:53 +01:00
|
|
|
|
2023-01-25 16:42:46 +01:00
|
|
|
export default function UserAddButton({ onSave }) {
|
2023-03-22 22:05:55 +01:00
|
|
|
const { formatMessage, labels } = useMessages();
|
2023-01-21 02:12:53 +01:00
|
|
|
|
|
|
|
const handleSave = () => {
|
2023-01-25 16:42:46 +01:00
|
|
|
onSave();
|
2023-01-21 02:12:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
2023-01-28 06:53:13 +01:00
|
|
|
<ModalTrigger>
|
|
|
|
<Button variant="primary">
|
2023-01-21 02:12:53 +01:00
|
|
|
<Icon>
|
2023-01-28 06:53:13 +01:00
|
|
|
<Icons.Plus />
|
2023-01-21 02:12:53 +01:00
|
|
|
</Icon>
|
2023-01-25 16:42:46 +01:00
|
|
|
<Text>{formatMessage(labels.createUser)}</Text>
|
2023-01-21 02:12:53 +01:00
|
|
|
</Button>
|
2023-01-28 06:53:13 +01:00
|
|
|
<Modal title={formatMessage(labels.createUser)}>
|
|
|
|
{close => <UserAddForm onSave={handleSave} onClose={close} />}
|
|
|
|
</Modal>
|
|
|
|
</ModalTrigger>
|
2023-01-21 02:12:53 +01:00
|
|
|
);
|
|
|
|
}
|