diff --git a/compass/app/auth/login/page.tsx b/compass/app/auth/login/page.tsx new file mode 100644 index 0000000..13879f3 --- /dev/null +++ b/compass/app/auth/login/page.tsx @@ -0,0 +1,57 @@ +// pages/index.tsx +'use client' +import Button from '@/components/Button'; +import Input from '@/components/Input' +import InlineLink from '@/components/InlineLink'; +import Paper from '@/components/auth/Paper'; +import { Metadata } from 'next' +import Image from 'next/image'; +import React, { useState } from 'react'; +import PasswordInput from '@/components/auth/PasswordInput'; + + +// export const metadata: Metadata = { +// title: 'Login', +// } + +export default function Page() { + const [visible, setVisible] = useState(false); + + return ( + <> + + +
+ Compass Center logo. +

Login

+
+ +
+
+ + + + +
+
+ + Forgot password? + + + +
+
+

+ © 2024 Compass Center +

+
+ + ); +}; \ No newline at end of file diff --git a/compass/app/page.tsx b/compass/app/page.tsx index bf62ac2..819622f 100644 --- a/compass/app/page.tsx +++ b/compass/app/page.tsx @@ -7,14 +7,16 @@ import Paper from '@/components/auth/Paper'; import { Metadata } from 'next' import Image from 'next/image'; import React, { useState } from 'react'; +import PasswordInput from '@/components/auth/PasswordInput'; -//export const metadata: Metadata = { -// title: 'Login', -//} +// export const metadata: Metadata = { +// title: 'Login', +// } export default function Page() { const [visible, setVisible] = useState(false); + return ( <> @@ -32,7 +34,9 @@ export default function Page() {
- + + +
diff --git a/compass/components/Input.tsx b/compass/components/Input.tsx index 7ace445..dfaee29 100644 --- a/compass/components/Input.tsx +++ b/compass/components/Input.tsx @@ -9,19 +9,12 @@ type InputProps = InputHTMLAttributes & { title?: string; // Assuming title is always a string type?: string; placeholder?: string; - passwordIcon?: keyof typeof Icons; - showIcon?: keyof typeof Icons; - hideIcon?: keyof typeof Icons; - pass?: boolean; + + }; -const Input: FunctionComponent = ({ iconKey, pass, showIcon, hideIcon, passwordIcon, type, title, placeholder, ...rest }) => { +const Input: FunctionComponent = ({ iconKey, type, title, placeholder, ...rest }) => { const IconComponent = iconKey ? Icons[iconKey] : null; - const PasswordIcon = passwordIcon ? Icons[passwordIcon] : null; - const [visible, setVisible] = useState (false); - const PassIcon = passwordIcon? Icons[passwordIcon] : null; - - return ( @@ -42,20 +35,14 @@ const Input: FunctionComponent = ({ iconKey, pass, showIcon, hideIco - - {PassIcon && ( - - setVisible(!visible)} /> - - - )}
diff --git a/compass/components/auth/PasswordInput.tsx b/compass/components/auth/PasswordInput.tsx new file mode 100644 index 0000000..71eb235 --- /dev/null +++ b/compass/components/auth/PasswordInput.tsx @@ -0,0 +1,54 @@ +'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;