created email input

This commit is contained in:
Advik Arora 2024-03-02 15:26:33 -05:00
parent 5029b32aec
commit a9bcb6761b
3 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,5 @@
"use client"
import Button from '@/components/Button49';
import Button from '@/components/Button';
import Input from '@/components/Input'
import InlineLink from '@/components/InlineLink';
import Paper from '@/components/auth/Paper';
@ -44,7 +44,7 @@ export default function Page() {
iconKey={'EmailInputIcon'}
onChange={(e) => {
setconfirmEmail(e.target.value);
setEmailError(''); // Reset the error when the user types
}}/>
{emailError && (
<p className={`mt-2 ${emailError.includes('exists in the database') ? 'text-green-500' : 'text-red-500'}`}>

View File

@ -0,0 +1,17 @@
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;

View File

@ -0,0 +1,9 @@
import { InputHTMLAttributes } from "react";
import { Icons } from "../constants";
export type InputProps = InputHTMLAttributes<HTMLInputElement> & {
iconKey?: keyof typeof Icons; // Use keyof typeof to ensure the key exists in Icons
title?: string; // Assuming title is always a string
type?: string;
placeholder?: string;
};