diff --git a/compass/app/auth/new_Password/page.tsx b/compass/app/auth/new_Password/page.tsx new file mode 100644 index 0000000..0ccee79 --- /dev/null +++ b/compass/app/auth/new_Password/page.tsx @@ -0,0 +1,76 @@ +// pages/index.tsx +"use client"; +import { useState, useEffect } from 'react'; +import Button from '@/components/Button'; +import Input from '@/components/Input'; +import Paper from '@/components/auth/Paper'; + + +function isStrongPassword(password: string): boolean { + const strongPasswordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*]).{8,}$/; + return strongPasswordRegex.test(password); +} + + +export default function Page() { + const [newPassword, setNewPassword] = useState(''); + const [confirmPassword, setConfirmPassword] = useState(''); + const [isButtonDisabled, setIsButtonDisabled] = useState(true); + + + useEffect(() => { + setIsButtonDisabled(newPassword === '' || confirmPassword === ''); + }, [newPassword, confirmPassword]); + + + return ( + <> + +
{ + e.preventDefault(); + if (newPassword === confirmPassword) { + console.log('Passwords match. Submitting form...'); + } else { + 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" + > +
+

New Password

+
+
+ { + setNewPassword(e.target.value); + }} + /> +
+
+ { + setConfirmPassword(e.target.value); + }} + /> +
+
+ +
+
+

© 2024 Compass Center

+
+ + ); +} + + + diff --git a/compass/components/Button.tsx b/compass/components/Button.tsx index 72c47f9..bf6dd55 100644 --- a/compass/components/Button.tsx +++ b/compass/components/Button.tsx @@ -3,21 +3,22 @@ import { FunctionComponent, ReactNode } from 'react'; type ButtonProps = { children: ReactNode; onClick?: () => void; // make the onClick handler optional + type?: "button" | "submit" | "reset"; // specify possible values for type + disabled?: boolean; }; -const Button: FunctionComponent = ({ children, onClick }) => { +const Button: FunctionComponent = ({ children, type, disabled, onClick }) => { + const buttonClassName = `inline-block rounded border ${disabled ? 'bg-gray-400 text-gray-600 cursor-not-allowed' : 'border-purple-600 bg-purple-600 text-white hover:bg-transparent hover:text-purple-600 focus:outline-none focus:ring active:text-purple-500'} px-12 py-3 text-sm font-semibold`; return ( ); }; + export default Button;