Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

feat: Added field validation for Email on sign in and sign up #286

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/SignIn/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ export function SignInForm() {
id='email'
autoComplete='email'
required
className='relative block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 text-gray-900 placeholder-gray-500 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm'
className='peer relative block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 text-gray-900 placeholder-gray-500 invalid:text-pink-600 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 focus:invalid:border-pink-500 focus:invalid:ring-pink-500 sm:text-sm'
value={email}
onChange={e => setEmail(e.target.value)}
/>
<p className={`invisible mt-2 text-sm text-pink-600 ${email.length > 0 ? 'peer-invalid:visible' : ''}`}>
Please provide a valid email address.
</p>
</div>
<div className='flex w-full flex-col space-y-2 '>
<label htmlFor='password' className='text-sm text-gray-600'>
Expand Down
5 changes: 4 additions & 1 deletion src/components/SignUp/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ export function SignUpForm() {
id='email'
autoComplete='email'
required
className='relative block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 text-gray-900 placeholder-gray-500 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm'
className='peer relative block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 text-gray-900 placeholder-gray-500 invalid:text-pink-600 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 focus:invalid:border-pink-500 focus:invalid:ring-pink-500 sm:text-sm'
value={email}
onChange={e => setEmail(e.target.value)}
/>
<p className={`invisible mt-2 text-sm text-pink-600 ${email.length > 0 ? 'peer-invalid:visible' : ''}`}>
Please provide a valid email address.
</p>
</div>
<div className='flex w-full flex-col space-y-2'>
<label htmlFor='username' className='text-sm text-gray-600'>
Expand Down