From 8cb4d38435a37ea5aabb76acc1900c7565e93e6c Mon Sep 17 00:00:00 2001 From: vgeffer Date: Sat, 9 Dec 2023 13:17:21 +0100 Subject: [PATCH] feat(pass-reset): added resset password button, added login dialog wrapper --- .../Authentication/Authentication.tsx | 4 +-- .../PageLayout/LoginForm/LoginForm.tsx | 8 ++--- .../LoginFormWrapper/LoginFormWrapper.tsx | 30 +++++++++++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx diff --git a/src/components/PageLayout/Authentication/Authentication.tsx b/src/components/PageLayout/Authentication/Authentication.tsx index 97e72320..bd36ab97 100644 --- a/src/components/PageLayout/Authentication/Authentication.tsx +++ b/src/components/PageLayout/Authentication/Authentication.tsx @@ -5,7 +5,7 @@ import {AuthContainer} from '@/utils/AuthContainer' import {useSeminarInfo} from '@/utils/useSeminarInfo' import {Overlay} from '../../Overlay/Overlay' -import {LoginForm} from '../LoginForm/LoginForm' +import {LoginFormWrapper} from '../LoginFormWrapper/LoginFormWrapper' import styles from './Authentication.module.scss' export const Authentication: FC = () => { @@ -28,7 +28,7 @@ export const Authentication: FC = () => {
- +
diff --git a/src/components/PageLayout/LoginForm/LoginForm.tsx b/src/components/PageLayout/LoginForm/LoginForm.tsx index 12e67c3e..15063e21 100644 --- a/src/components/PageLayout/LoginForm/LoginForm.tsx +++ b/src/components/PageLayout/LoginForm/LoginForm.tsx @@ -6,6 +6,8 @@ import styles from '@/components/FormItems/Form.module.scss' import {FormInput} from '@/components/FormItems/FormInput/FormInput' import {AuthContainer} from '@/utils/AuthContainer' +import {ILoginFormWrapper} from '../LoginFormWrapper/LoginFormWrapper' + type LoginFormValues = { email: string password: string @@ -16,11 +18,7 @@ const defaultValues: LoginFormValues = { password: '', } -interface ILoginForm { - closeOverlay: () => void -} - -export const LoginForm: FC = ({closeOverlay}) => { +export const LoginForm: FC = ({closeOverlay}) => { const {login} = AuthContainer.useContainer() const {handleSubmit, control} = useForm({defaultValues}) diff --git a/src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx b/src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx new file mode 100644 index 00000000..f2381dfe --- /dev/null +++ b/src/components/PageLayout/LoginFormWrapper/LoginFormWrapper.tsx @@ -0,0 +1,30 @@ +import {FC, useState} from 'react' + +import {Button} from '@/components/Clickable/Clickable' + +import {LoginForm} from '../LoginForm/LoginForm' +import {PasswordResetRequestForm} from '../PasswordReset/PasswordResetRequest' + +export interface ILoginFormWrapper { + closeOverlay: () => void +} + +export const LoginFormWrapper: FC = ({closeOverlay}) => { + const [form, changeForm] = useState('login') + + if (form === 'login') + return ( + <> + + + + ) + + return +}