diff --git a/src/components/Disclosure/Disclosure.module.scss b/src/components/Disclosure/Disclosure.module.scss new file mode 100644 index 00000000..43e19ccb --- /dev/null +++ b/src/components/Disclosure/Disclosure.module.scss @@ -0,0 +1,8 @@ +.arrow { + transition: transform 0.3s ease-in-out; + transform: rotate(90deg); +} + +.arrowOpen { + transform: rotate(270deg); +} diff --git a/src/components/Disclosure/Disclosure.tsx b/src/components/Disclosure/Disclosure.tsx new file mode 100644 index 00000000..eb7c9235 --- /dev/null +++ b/src/components/Disclosure/Disclosure.tsx @@ -0,0 +1,68 @@ +import { + Disclosure as DisclosureComponent, + Transition, +} from '@headlessui/react'; + +import ArrowRightLight from '@media/UI/arrow-right-light.svg'; +import ArrowRightDark from '@media/UI/arrow-right-dark.svg'; +import React, { Fragment, useContext } from 'react'; +import ThemeContext from '@context/ThemeContext'; + +import classes from './Disclosure.module.scss'; + +interface DisclosureProps { + title: string; + children: React.ReactNode; + defaultOpen?: boolean; + buttonClassName?: string; + conentClassName?: string; +} + +export default function Disclosure({ + title, + children, + defaultOpen, + buttonClassName, + conentClassName, +}: DisclosureProps) { + const { theme } = useContext(ThemeContext); + + const getArrowClasses = (open: boolean) => + `absolute right-4 top-5 ${classes.arrow} ${open ? classes.arrowOpen : ''}`; + + return ( + + {({ open }) => ( + <> + + {title} + {theme === 'light' ? ( + + ) : ( + + )} + +
+ + + {children} + + +
+ + )} +
+ ); +} diff --git a/src/components/Modals/PasswordModal/PasswordModal.tsx b/src/components/Modals/PasswordModal/PasswordModal.tsx index b7681bb9..1f0b44c9 100644 --- a/src/components/Modals/PasswordModal/PasswordModal.tsx +++ b/src/components/Modals/PasswordModal/PasswordModal.tsx @@ -2,12 +2,16 @@ import { FC, useState } from 'react'; import { Modal } from '@components/Modals'; import { Button } from '@components/Buttons'; import FeedbackMessage from '@components/FeedbackMessage/FeedbackMessage'; -import Spinner from '@components/Spinner/Spinner'; import AuthenticationInput from '../../Inputs/AuthenticationInput/AuthenticationInput'; import { useForm } from 'react-hook-form'; import { FieldError } from 'react-hook-form/dist/types/errors'; import { MIN_PASSWORD_LENGTH } from '@utils/password'; import { useLocales } from '@context/LocalesContext'; +import Disclosure from '@components/Disclosure/Disclosure'; +import { + getMetamaskPassphraseExplanation, + setMetamaskPassphraseExplanation, +} from '@utils/localStorage'; interface PasswordModalProps { showModal: boolean; @@ -32,6 +36,7 @@ const PasswordModal: FC = ({ setLoading(true); try { await handleSubmitForm(data.password); + setMetamaskPassphraseExplanation(false); closeModal(); } catch (e) { setErrorMessage(intl.get('GENERIC_ERROR', { message: e.message })); @@ -68,7 +73,16 @@ const PasswordModal: FC = ({

{intl.get('PASSPHRASE_EXPLANATION')}

-

{intl.get('PASSPHRASE_EXPLANATION_2')}

+
+ +

+ {intl.get('PASSPHRASE_EXPLANATION_2')} +

+
+