diff --git a/web/settings/account-delete-modal.css b/web/settings/account-delete-modal.css index 306fe03eb..a6ce8ac4e 100644 --- a/web/settings/account-delete-modal.css +++ b/web/settings/account-delete-modal.css @@ -1,26 +1,29 @@ .modal_body { - padding: 24px 32px; color: var(--fg); } .modal_body p { font-size: var(--s-font-14); } .deletion_warning { font-weight: var(--bold); - margin-bottom: 16px; } -.form_footer { - display: flex; - flex-direction: row-reverse; - justify-content: space-between; - padding-top: 24px; -} .form_error { font-size: var(--xs-font-12); color: var(--error); font-style: italic; - padding-left: 6px; - align-self: center; + height: 24px; + display: flex; + justify-content: center; + align-items: flex-end; +} + +.errorPlaceholder { + height: 24px; +} + +.infoContainer { + display: flex; + column-gap: 8px; } diff --git a/web/settings/account-delete-modal.react.js b/web/settings/account-delete-modal.react.js index 848075165..0c2be8ba1 100644 --- a/web/settings/account-delete-modal.react.js +++ b/web/settings/account-delete-modal.react.js @@ -1,94 +1,105 @@ // @flow import * as React from 'react'; import { useDeleteAccount, deleteAccountActionTypes, } from 'lib/actions/user-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import css from './account-delete-modal.css'; import Button, { buttonThemes } from '../components/button.react.js'; import Modal from '../modals/modal.react.js'; import { useSelector } from '../redux/redux-utils.js'; const deleteAccountLoadingStatusSelector = createLoadingStatusSelector( deleteAccountActionTypes, ); const AccountDeleteModal: React.ComponentType<{}> = React.memo<{}>( function AccountDeleteModal(): React.Node { const inputDisabled = useSelector( state => deleteAccountLoadingStatusSelector(state) === 'loading', ); const callDeleteAccount = useDeleteAccount(); const dispatchActionPromise = useDispatchActionPromise(); const { popModal } = useModalContext(); const [errorMessage, setErrorMessage] = React.useState(''); let error; if (errorMessage) { error = (

{errorMessage}

); } const deleteAccountAction = React.useCallback(async () => { try { setErrorMessage(''); const response = await callDeleteAccount(); popModal(); return response; } catch (e) { setErrorMessage('unknown error deleting account'); throw e; } }, [callDeleteAccount, popModal]); const onDelete = React.useCallback( (event: SyntheticEvent) => { event.preventDefault(); void dispatchActionPromise( deleteAccountActionTypes, deleteAccountAction(), ); }, - [dispatchActionPromise, deleteAccountAction], + [deleteAccountAction, dispatchActionPromise], + ); + + const primaryButton = React.useMemo( + () => ( + + ), + [inputDisabled, onDelete], ); return ( - +
- -

- Your account will be permanently deleted. There is no way to - reverse this. -

-
- - {error} +
+ +

+ Your account will be permanently deleted. There is no way to + reverse this. +

+ {error}
); }, ); export default AccountDeleteModal;