umami/components/pages/settings/users/UserAddButton.js

27 lines
705 B
JavaScript
Raw Normal View History

2023-01-25 16:42:46 +01:00
import { useIntl } from 'react-intl';
import { Button, Icon, Text, Modal, Icons, ModalTrigger } from 'react-basics';
2023-01-24 00:32:35 +01:00
import UserAddForm from './UserAddForm';
import { labels } from 'components/messages';
2023-01-21 02:12:53 +01:00
2023-01-25 16:42:46 +01:00
export default function UserAddButton({ onSave }) {
2023-01-21 02:12:53 +01:00
const { formatMessage } = useIntl();
const handleSave = () => {
2023-01-25 16:42:46 +01:00
onSave();
2023-01-21 02:12:53 +01:00
};
return (
<ModalTrigger>
<Button variant="primary">
2023-01-21 02:12:53 +01:00
<Icon>
<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>
<Modal title={formatMessage(labels.createUser)}>
{close => <UserAddForm onSave={handleSave} onClose={close} />}
</Modal>
</ModalTrigger>
2023-01-21 02:12:53 +01:00
);
}