This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rewrite signup and signin page with tailwind UI (#107)
* feat: rewrite signup and signin page with tailwind UI #100 * fix: add corrections #100 * fix: add changes #100 * fix: add changes #100 * fix: add changes #100 * fix: add changes #100 * fix: add changes (#100) * fix: refactor * fix: fix typo in signup form * fix: fix typo in signup form
- Loading branch information
1 parent
cbd238b
commit 83de475
Showing
10 changed files
with
290 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL | ||
NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY | ||
NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { useState } from 'react'; | ||
import { supabase } from '../../utils/supabaseClient'; | ||
import { FaLock } from 'react-icons/fa'; | ||
|
||
export const SignInForm = () => { | ||
const [email, setEmail] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
const handleSignIn = async () => { | ||
const { user, error } = await supabase.auth.signIn({ email, password }); | ||
if (error) alert(error.message); | ||
else { | ||
alert(`Success Login in ${user?.email}`); | ||
setEmail(''); | ||
setPassword(''); | ||
} | ||
}; | ||
return ( | ||
<form | ||
className='mt-4 space-y-4' | ||
onSubmit={e => { | ||
e.preventDefault(); | ||
handleSignIn(); | ||
}} | ||
> | ||
<div className='flex w-full flex-col space-y-3'> | ||
<label htmlFor='email-address' className='text-sm text-gray-600'> | ||
Email address | ||
</label> | ||
<input | ||
type='email' | ||
id='email-address' | ||
placeholder='example@gmail.com' | ||
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' | ||
value={email} | ||
onChange={e => setEmail(e.target.value)} | ||
/> | ||
</div> | ||
<div className='flex w-full flex-col space-y-2 '> | ||
<label htmlFor='password' className='text-sm text-gray-600'> | ||
password | ||
</label> | ||
<input | ||
type='password' | ||
id='password' | ||
required | ||
className='relative flex w-full appearance-none justify-center 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' | ||
placeholder='*****' | ||
value={password} | ||
onChange={e => setPassword(e.target.value)} | ||
/> | ||
</div> | ||
{/*TODO: REMEMBER ME AND FORGOT PASSWORD FUNCTIONALITY */} | ||
{/* <div className='flex items-center justify-between'> | ||
<div className='flex items-center'> | ||
<input | ||
id='remember-me' | ||
name='remember-me' | ||
type='checkbox' | ||
className='h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500' | ||
/> | ||
<label htmlFor='remember-me' className='ml-2 block text-sm text-gray-900'> | ||
{' '} | ||
Remember me{' '} | ||
</label> | ||
</div> | ||
<div className='text-sm'> | ||
<a href='#' className='font-medium text-indigo-600 hover:text-indigo-500'> | ||
{' '} | ||
Forgot your password?{' '} | ||
</a> | ||
</div> | ||
</div> */} | ||
<button | ||
type='submit' | ||
className='group relative my-4 flex w-full justify-center rounded-md border border-transparent bg-indigo-600 py-2 px-4 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2' | ||
> | ||
<span className='absolute inset-y-0 left-0 flex items-center pl-3'> | ||
<FaLock className='text-base text-indigo-500 group-hover:text-indigo-400' /> | ||
</span> | ||
Sign in | ||
</button> | ||
</form> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { FaGithub, FaGoogle } from 'react-icons/fa'; | ||
|
||
export const SignInSocial = () => { | ||
return ( | ||
<div className='mt-6'> | ||
<p className='text-sm text-gray-700'>Sign in with</p> | ||
<div className='my-2 grid grid-cols-2 gap-4'> | ||
<div> | ||
<a | ||
href='#' | ||
className='inline-flex w-full justify-center rounded-md border border-gray-300 bg-white py-2 px-4 text-sm font-medium text-gray-500 shadow-sm hover:bg-gray-50' | ||
> | ||
<span className='sr-only'>Sign in with Google</span> | ||
<FaGoogle className='text-xl text-gray-500' /> | ||
</a> | ||
</div> | ||
|
||
<div> | ||
<a | ||
href='#' | ||
className='inline-flex w-full justify-center rounded-md border border-gray-300 bg-white py-2 px-4 text-sm font-medium text-gray-500 shadow-sm hover:bg-gray-50' | ||
> | ||
<span className='sr-only'>Sign in with GitHub</span> | ||
<FaGithub className='text-xl text-gray-500' /> | ||
</a> | ||
</div> | ||
</div> | ||
<div className='relative mt-6'> | ||
<div className='absolute inset-0 flex items-center' aria-hidden='true'> | ||
<div className='w-full border-t border-gray-300' /> | ||
</div> | ||
<div className='relative flex justify-center text-sm'> | ||
<span className='bg-white px-2 text-gray-500'>Or continue with</span> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useState } from 'react'; | ||
import { supabase } from '../../utils/supabaseClient'; | ||
|
||
export const SignUpForm = () => { | ||
const [email, setEmail] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
const handleSignUp = async () => { | ||
const { user, error } = await supabase.auth.signUp({ email, password }); | ||
if (error) alert(error.message); | ||
else { | ||
alert(`Success Register in ${user?.email}`); | ||
setEmail(''); | ||
setPassword(''); | ||
} | ||
}; | ||
return ( | ||
<form | ||
onSubmit={e => { | ||
e.preventDefault(); | ||
handleSignUp(); | ||
}} | ||
className='mt-4 flex flex-col space-y-4' | ||
> | ||
<div className='flex w-full flex-col space-y-2'> | ||
<label htmlFor='email-address' className='text-sm text-gray-600'> | ||
Email address | ||
</label> | ||
<input | ||
type='email' | ||
id='email-address' | ||
placeholder='example@gmail.com' | ||
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' | ||
value={email} | ||
onChange={e => setEmail(e.target.value)} | ||
/> | ||
</div> | ||
<div className='flex w-full flex-col space-y-2 '> | ||
<label htmlFor='password' className='text-sm text-gray-600'> | ||
Password | ||
</label> | ||
<input | ||
type='password' | ||
id='password' | ||
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' | ||
placeholder='*****' | ||
value={password} | ||
onChange={e => setPassword(e.target.value)} | ||
/> | ||
</div> | ||
<button | ||
type='submit' | ||
onClick={handleSignUp} | ||
className='group relative my-4 flex w-full justify-center rounded-md border border-transparent bg-indigo-600 py-2 px-4 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2' | ||
> | ||
Sign up | ||
</button> | ||
</form> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { FaGithub, FaGoogle } from 'react-icons/fa'; | ||
|
||
export const SignUpSocial = () => { | ||
return ( | ||
<div className='mt-6'> | ||
<p className='text-sm text-gray-700'>Sign up with</p> | ||
<div className='my-2 grid grid-cols-2 gap-4'> | ||
<div> | ||
<a | ||
href='#' | ||
className='inline-flex w-full justify-center rounded-md border border-gray-300 bg-white py-2 px-4 text-sm font-medium text-gray-500 shadow-sm hover:bg-gray-50' | ||
> | ||
<span className='sr-only'>Sign in with Google</span> | ||
<FaGoogle className='text-xl text-gray-500' /> | ||
</a> | ||
</div> | ||
|
||
<div> | ||
<a | ||
href='#' | ||
className='inline-flex w-full justify-center rounded-md border border-gray-300 bg-white py-2 px-4 text-sm font-medium text-gray-500 shadow-sm hover:bg-gray-50' | ||
> | ||
<span className='sr-only'>Sign in with GitHub</span> | ||
<FaGithub className='text-xl text-gray-500' /> | ||
</a> | ||
</div> | ||
</div> | ||
<div className='relative mt-6'> | ||
<div className='absolute inset-0 flex items-center' aria-hidden='true'> | ||
<div className='w-full border-t border-gray-300' /> | ||
</div> | ||
<div className='relative flex justify-center text-sm'> | ||
<span className='bg-white px-2 text-gray-500'>Or continue with</span> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
/** @type {import('next').NextConfig} */ | ||
module.exports = { | ||
reactStrictMode: true, | ||
images: { | ||
domains: ['images.unsplash.com'], | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
83de475
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
defaang – ./
defaang-git-main-ykdojo.vercel.app
defaang.vercel.app
defaang-ykdojo.vercel.app