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