mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
33 lines
952 B
JavaScript
33 lines
952 B
JavaScript
import { Button, Icon, Text, useToast, ModalTrigger, Modal } from 'react-basics';
|
|
import PasswordEditForm from 'components/pages/settings/profile/PasswordEditForm';
|
|
import Icons from 'components/icons';
|
|
import useMessages from 'hooks/useMessages';
|
|
|
|
export function PasswordChangeButton() {
|
|
const { formatMessage, labels, messages } = useMessages();
|
|
const { toast, showToast } = useToast();
|
|
|
|
const handleSave = () => {
|
|
showToast({ message: formatMessage(messages.saved), variant: 'success' });
|
|
};
|
|
|
|
return (
|
|
<>
|
|
{toast}
|
|
<ModalTrigger>
|
|
<Button>
|
|
<Icon>
|
|
<Icons.Lock />
|
|
</Icon>
|
|
<Text>{formatMessage(labels.changePassword)}</Text>
|
|
</Button>
|
|
<Modal title={formatMessage(labels.changePassword)}>
|
|
{close => <PasswordEditForm onSave={handleSave} onClose={close} />}
|
|
</Modal>
|
|
</ModalTrigger>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default PasswordChangeButton;
|