mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-10 06:10:17 -04:00
Fixed heading, dimension, and password input
This commit is contained in:
parent
284a9f3a9e
commit
f47bc76514
|
@ -40,15 +40,14 @@ export default function Page() {
|
||||||
<>
|
<>
|
||||||
<Paper>
|
<Paper>
|
||||||
<form
|
<form
|
||||||
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">
|
||||||
<h1 className="text-2xl font-bold text-purple-700 sm:text-3xl">Forgot password</h1>
|
<h1 className="font-bold text-xl text-purple-800">Forgot password</h1>
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<Input type='email'
|
<Input type='email'
|
||||||
title="Enter your email address"
|
title="Enter your email address"
|
||||||
placeholder="janedoe@gmail.com"
|
placeholder="janedoe@gmail.com"
|
||||||
//setting a placeholder in the email input box
|
//setting a placeholder in the email input box
|
||||||
value={confirmEmail}
|
value={confirmEmail}
|
||||||
icon={'EmailInputIcon'}
|
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setconfirmEmail(e.target.value);
|
setconfirmEmail(e.target.value);
|
||||||
}}/>
|
}}/>
|
||||||
|
|
|
@ -55,7 +55,7 @@ export default function Page() {
|
||||||
<h1 className='font-bold text-xl text-purple-800'>Login</h1>
|
<h1 className='font-bold text-xl text-purple-800'>Login</h1>
|
||||||
|
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<Input type='email' title="Email" placeholder="janedoe@gmail.com" icon={'EmailInputIcon'} onChange={handleEmailChange} required />
|
<Input type='email' title="Email" placeholder="janedoe@gmail.com" onChange={handleEmailChange} required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mb-6">
|
<div className="mb-6">
|
||||||
|
|
|
@ -7,6 +7,7 @@ import Input from '@/components/Input';
|
||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
|
|
||||||
import Paper from '@/components/auth/Paper';
|
import Paper from '@/components/auth/Paper';
|
||||||
|
import PasswordInput from '@/components/auth/PasswordInput';
|
||||||
|
|
||||||
|
|
||||||
function isStrongPassword(password: string): boolean {
|
function isStrongPassword(password: string): boolean {
|
||||||
|
@ -37,13 +38,13 @@ export default function Page() {
|
||||||
console.log('Passwords do not match. Please try again.');
|
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"
|
||||||
>
|
>
|
||||||
<div className="text-center sm:text-left">
|
<div className="text-center sm:text-left">
|
||||||
<h1 className="text-2xl font-bold text-blue-900 sm:text-3xl">New Password</h1>
|
<h1 className="font-bold text-xl text-purple-800">New Password</h1>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<Input
|
<PasswordInput
|
||||||
type="password"
|
type="password"
|
||||||
title="Enter New Password"
|
title="Enter New Password"
|
||||||
value={newPassword}
|
value={newPassword}
|
||||||
|
@ -60,7 +61,7 @@ export default function Page() {
|
||||||
</p>
|
</p>
|
||||||
</div>}
|
</div>}
|
||||||
<div className="mb-6">
|
<div className="mb-6">
|
||||||
<Input
|
<PasswordInput
|
||||||
type="password"
|
type="password"
|
||||||
title="Confirm Password"
|
title="Confirm Password"
|
||||||
value={confirmPassword}
|
value={confirmPassword}
|
|
@ -14,18 +14,21 @@ const Input: FunctionComponent<InputProps> = ({ icon, type, title, placeholder,
|
||||||
<div>
|
<div>
|
||||||
<label
|
<label
|
||||||
htmlFor={title}
|
htmlFor={title}
|
||||||
// this class name should be simplified, was just having problems with it
|
|
||||||
className={valid ? "block overflow-hidden rounded-md border border-gray-200 px-3 py-2 shadow-sm focus-within:border-purple-600 focus-within:ring-1 focus-within:ring-purple-600" : "block overflow-hidden rounded-md border border-gray-200 px-3 py-2 shadow-sm focus-within:border-red-600 focus-within:ring-1 focus-within:ring-red-600"}
|
className={valid ? "block overflow-hidden rounded-md border border-gray-200 px-3 py-2 shadow-sm focus-within:border-purple-600 focus-within:ring-1 focus-within:ring-purple-600" : "block overflow-hidden rounded-md border border-gray-200 px-3 py-2 shadow-sm focus-within:border-red-600 focus-within:ring-1 focus-within:ring-red-600"}
|
||||||
>
|
>
|
||||||
<span className="text-xs font-semibold text-gray-700"> {title} </span>
|
<span className="text-xs font-semibold text-gray-700"> {title} </span>
|
||||||
|
<div className="mt-1 flex items-center">
|
||||||
<input
|
<input
|
||||||
type={type}
|
type={type}
|
||||||
id={title}
|
id={title}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
className="mt-1 w-full border-none p-0 focus:border-transparent focus:outline-none focus:ring-0 sm:text-sm"
|
className="w-full border-none p-0 focus:border-transparent focus:outline-none focus:ring-0 sm:text-sm"
|
||||||
/>
|
/>
|
||||||
|
<span className="inline-flex items-center px-3 text-gray-500">
|
||||||
|
{icon}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
import React, { useState } from 'react';
|
|
||||||
import Input from '@/components/Input'
|
|
||||||
import { InputProps } from '@/utils/classes/InputProps';
|
|
||||||
|
|
||||||
const EmailInput: React.FunctionComponent<InputProps> = ({ type, title, placeholder, ...rest }) => {
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Input
|
|
||||||
type='email'
|
|
||||||
title="Enter your email address"
|
|
||||||
placeholder="janedoe@gmail.com"
|
|
||||||
iconKey={'EmailInputIcon'}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EmailInput;
|
|
|
@ -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 { Icons } from '@/utils/constants';
|
||||||
import React, { FunctionComponent, InputHTMLAttributes, ReactElement, ReactNode, useState} from 'react';
|
|
||||||
|
|
||||||
|
type PasswordInputProps = {
|
||||||
type InputProps = InputHTMLAttributes<HTMLInputElement> & {
|
title?: ReactNode; // Assuming you might want to reuse title, placeholder etc.
|
||||||
title?: string; // Assuming title is always a string
|
placeholder?: ReactNode;
|
||||||
type?: string;
|
valid?: boolean;
|
||||||
placeholder?: string;
|
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const PasswordInput: FunctionComponent<InputProps> = ({ type, title, placeholder, ...rest }) => {
|
const PasswordInput: FunctionComponent<PasswordInputProps> = ({ onChange, valid = true, ...rest }) => {
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
const [visible, setVisible] = useState (false);
|
const toggleVisibility = () => {
|
||||||
const PasswordIcon = visible ? Icons['HidePasswordIcon'] : Icons['UnhidePasswordIcon'];
|
setVisible(!visible);
|
||||||
|
};
|
||||||
|
|
||||||
|
const PasswordIcon = visible ? Icons['HidePasswordIcon'] : Icons['UnhidePasswordIcon'];
|
||||||
|
|
||||||
|
// Render the Input component and pass the PasswordIcon as an icon prop
|
||||||
return (
|
return (
|
||||||
<div className="mb-4">
|
<Input
|
||||||
{title && (
|
{...rest}
|
||||||
<div className="mb-1">
|
type={visible ? "text" : "password"}
|
||||||
<label htmlFor={title} className="text-sm font-semibold text-gray-700">
|
onChange={onChange}
|
||||||
{title}
|
valid={valid}
|
||||||
</label>
|
icon={
|
||||||
</div>
|
<PasswordIcon className="h-5 w-5" onClick={toggleVisibility} />
|
||||||
)}
|
}
|
||||||
<div className="flex items-center border border-gray-300 rounded-md shadow-sm overflow-hidden">
|
/>
|
||||||
|
|
||||||
<input
|
|
||||||
{...rest}
|
|
||||||
type={visible ? "text" : "password"}
|
|
||||||
id={title}
|
|
||||||
placeholder={placeholder}
|
|
||||||
className="w-full border-none p-3 text-sm focus:ring-0"
|
|
||||||
style={{ boxShadow: 'none' }} // This ensures that the input doesn't have an inner shadow
|
|
||||||
/>
|
|
||||||
|
|
||||||
{PasswordIcon && (
|
|
||||||
<span className="inline-flex items-center px-3 border-r border-gray-300 text-gray-500">
|
|
||||||
<PasswordIcon className="h-5 w-5" onClick={() => setVisible(!visible)}/>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user