mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
28 lines
701 B
JavaScript
28 lines
701 B
JavaScript
import { Button, Icon, Text, Modal, Icons, ModalTrigger } from 'react-basics';
|
|
import UserAddForm from './UserAddForm';
|
|
import useMessages from 'hooks/useMessages';
|
|
|
|
export function UserAddButton({ onSave }) {
|
|
const { formatMessage, labels } = useMessages();
|
|
|
|
const handleSave = () => {
|
|
onSave();
|
|
};
|
|
|
|
return (
|
|
<ModalTrigger>
|
|
<Button variant="primary">
|
|
<Icon>
|
|
<Icons.Plus />
|
|
</Icon>
|
|
<Text>{formatMessage(labels.createUser)}</Text>
|
|
</Button>
|
|
<Modal title={formatMessage(labels.createUser)}>
|
|
{close => <UserAddForm onSave={handleSave} onClose={close} />}
|
|
</Modal>
|
|
</ModalTrigger>
|
|
);
|
|
}
|
|
|
|
export default UserAddButton;
|