From f47bc7651436a00b441b08440e62d9f9602f22a4 Mon Sep 17 00:00:00 2001 From: Meliora Ho Date: Sun, 3 Mar 2024 18:15:17 +0000 Subject: [PATCH] Fixed heading, dimension, and password input --- compass/app/auth/forgot_password/page.tsx | 5 +- compass/app/auth/login/page.tsx | 2 +- .../{newPassword => new_password}/page.tsx | 9 +-- compass/components/Input.tsx | 9 ++- compass/components/auth/EmailInput.tsx | 17 ------ compass/components/auth/PasswordInput.tsx | 61 ++++++++----------- 6 files changed, 38 insertions(+), 65 deletions(-) rename compass/app/auth/{newPassword => new_password}/page.tsx (91%) delete mode 100644 compass/components/auth/EmailInput.tsx diff --git a/compass/app/auth/forgot_password/page.tsx b/compass/app/auth/forgot_password/page.tsx index 05323ee..5a57226 100644 --- a/compass/app/auth/forgot_password/page.tsx +++ b/compass/app/auth/forgot_password/page.tsx @@ -40,15 +40,14 @@ export default function Page() { <>
-

Forgot password

+ className="mb-0 m-auto mt-6 space-y-4 rounded-lg p-4 shadow-lg sm:p-6 lg:p-8 bg-white max-w-xl"> +

Forgot password

{ setconfirmEmail(e.target.value); }}/> diff --git a/compass/app/auth/login/page.tsx b/compass/app/auth/login/page.tsx index 5caa7b4..0284517 100644 --- a/compass/app/auth/login/page.tsx +++ b/compass/app/auth/login/page.tsx @@ -55,7 +55,7 @@ export default function Page() {

Login

- +
diff --git a/compass/app/auth/newPassword/page.tsx b/compass/app/auth/new_password/page.tsx similarity index 91% rename from compass/app/auth/newPassword/page.tsx rename to compass/app/auth/new_password/page.tsx index 506da4e..ba9ebde 100644 --- a/compass/app/auth/newPassword/page.tsx +++ b/compass/app/auth/new_password/page.tsx @@ -7,6 +7,7 @@ import Input from '@/components/Input'; import Button from '@/components/Button'; import Paper from '@/components/auth/Paper'; +import PasswordInput from '@/components/auth/PasswordInput'; function isStrongPassword(password: string): boolean { @@ -37,13 +38,13 @@ export default function Page() { console.log('Passwords do not match. Please try again.'); } }} - className="mb-0 mt-6 mb-6 space-y-4 rounded-lg p-4 shadow-lg sm:p-6 lg:p-8 bg-white" + className="mb-0 m-auto mt-6 space-y-4 rounded-lg p-4 shadow-lg sm:p-6 lg:p-8 bg-white max-w-xl" >
-

New Password

+

New Password

-
}
- = ({ icon, type, title, placeholder,
); diff --git a/compass/components/auth/EmailInput.tsx b/compass/components/auth/EmailInput.tsx deleted file mode 100644 index cb3a829..0000000 --- a/compass/components/auth/EmailInput.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React, { useState } from 'react'; -import Input from '@/components/Input' -import { InputProps } from '@/utils/classes/InputProps'; - -const EmailInput: React.FunctionComponent = ({ type, title, placeholder, ...rest }) => { - - return ( - - ); -}; - -export default EmailInput; diff --git a/compass/components/auth/PasswordInput.tsx b/compass/components/auth/PasswordInput.tsx index f196ec4..c7f3b70 100644 --- a/compass/components/auth/PasswordInput.tsx +++ b/compass/components/auth/PasswordInput.tsx @@ -1,47 +1,34 @@ -'use client' +import React, { useState, FunctionComponent, ChangeEvent, ReactNode } from 'react'; +import Input from '../Input'; // Adjust the import path as necessary import { Icons } from '@/utils/constants'; -import React, { FunctionComponent, InputHTMLAttributes, ReactElement, ReactNode, useState} from 'react'; - -type InputProps = InputHTMLAttributes & { - title?: string; // Assuming title is always a string - type?: string; - placeholder?: string; +type PasswordInputProps = { + title?: ReactNode; // Assuming you might want to reuse title, placeholder etc. + placeholder?: ReactNode; + valid?: boolean; + onChange: (event: ChangeEvent) => void; }; -const PasswordInput: FunctionComponent = ({ type, title, placeholder, ...rest }) => { +const PasswordInput: FunctionComponent = ({ onChange, valid = true, ...rest }) => { + const [visible, setVisible] = useState(false); - const [visible, setVisible] = useState (false); - const PasswordIcon = visible ? Icons['HidePasswordIcon'] : Icons['UnhidePasswordIcon']; + const toggleVisibility = () => { + setVisible(!visible); + }; + const PasswordIcon = visible ? Icons['HidePasswordIcon'] : Icons['UnhidePasswordIcon']; + + // Render the Input component and pass the PasswordIcon as an icon prop return ( -
- {title && ( -
- -
- )} -
- - - - {PasswordIcon && ( - - setVisible(!visible)}/> - - )} - -
-
+ + } + /> ); };