diff --git a/compass/app/page.tsx b/compass/app/page.tsx index 3ab3991..9ba509d 100644 --- a/compass/app/page.tsx +++ b/compass/app/page.tsx @@ -12,6 +12,7 @@ import {ChangeEvent, useState} from "react"; // export const metadata: Metadata = { // title: 'Login', // } +import PasswordInput from '@/components/auth/PasswordInput'; export default function Page() { const [email, setEmail] = useState(""); @@ -59,10 +60,10 @@ export default function Page() { />

Login

- +
- +
diff --git a/compass/components/auth/PasswordInput.tsx b/compass/components/auth/PasswordInput.tsx new file mode 100644 index 0000000..f196ec4 --- /dev/null +++ b/compass/components/auth/PasswordInput.tsx @@ -0,0 +1,48 @@ +'use client' +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; +}; + +const PasswordInput: FunctionComponent = ({ type, title, placeholder, ...rest }) => { + + const [visible, setVisible] = useState (false); + const PasswordIcon = visible ? Icons['HidePasswordIcon'] : Icons['UnhidePasswordIcon']; + + return ( +
+ {title && ( +
+ +
+ )} +
+ + + + {PasswordIcon && ( + + setVisible(!visible)}/> + + )} + +
+
+ ); +}; + +export default PasswordInput;