-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add progress bar, refactor auth structure
- Loading branch information
Showing
8 changed files
with
164 additions
and
112 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use client'; | ||
|
||
import { ReactNode } from 'react'; | ||
import { FormDiv, OuterDiv } from './styles'; | ||
|
||
export default function layout({ children }: { children: ReactNode }) { | ||
return ( | ||
<OuterDiv> | ||
<FormDiv>{children}</FormDiv> | ||
</OuterDiv> | ||
); | ||
} |
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,89 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
import { useRouter } from 'next/navigation'; | ||
import TextInput from '@/components/TextInput/index'; | ||
import { H1, H4, P, AColored } from '@/styles/text'; | ||
import supabase from '@/api/supabase/createClient'; | ||
import COLORS from '@/styles/colors'; | ||
import BigButton from '@/components/BigButton'; | ||
import { H4Centered, QuestionsDiv, SpacerDiv } from '../styles'; | ||
|
||
export default function Login() { | ||
const [email, setEmail] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
// const [errorMessage, setErrorMessage] = useState(''); | ||
const { push } = useRouter(); | ||
// commenting out Sign Up to use in the next PR -> create a separate sign in page | ||
/* | ||
const handleSignUp = async () => { | ||
const { error } = await supabase.auth.signUp({ | ||
email, | ||
password, | ||
}); | ||
if (error) { | ||
throw new Error(`An error occurred trying to sign up: ${error.message}`); | ||
} | ||
push('/'); | ||
}; | ||
*/ | ||
|
||
const handleSignIn = async () => { | ||
const { error } = await supabase.auth.signInWithPassword({ | ||
email, | ||
password, | ||
}); | ||
|
||
if (error) { | ||
throw new Error(`An error occurred trying to sign in: ${error.message}`); | ||
} | ||
push('/'); | ||
}; | ||
|
||
return ( | ||
<> | ||
<H1>Log In</H1> | ||
<SpacerDiv> | ||
<QuestionsDiv> | ||
<TextInput | ||
label="Email" | ||
placeholder="[email protected]" | ||
erroring={false} | ||
errorText="Email Error" // {errorMessage} | ||
type="email" | ||
name="email" | ||
value={email} | ||
setValue={setEmail} | ||
/> | ||
<TextInput | ||
label="Password" | ||
placeholder="Password" | ||
erroring={false} | ||
errorText="Password Error" | ||
type="password" | ||
name="password" | ||
value={password} | ||
setValue={setPassword} | ||
/> | ||
</QuestionsDiv> | ||
<P> | ||
<AColored $color={COLORS.greyMid} href="/reset-password"> | ||
Forgot your password? | ||
</AColored> | ||
</P> | ||
</SpacerDiv> | ||
<SpacerDiv> | ||
<BigButton type="button" onClick={handleSignIn}> | ||
<H4 $color="white">Sign in</H4> | ||
</BigButton> | ||
<H4Centered> | ||
Don’t have an account yet?{' '} | ||
<AColored $color={COLORS.greyDark} href="/"> | ||
Sign up | ||
</AColored> | ||
</H4Centered> | ||
</SpacerDiv> | ||
</> | ||
); | ||
} |
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,19 @@ | ||
'use client'; | ||
|
||
import BigButton from '@/components/BigButton'; | ||
import ProgressBar from '@/components/ProgressBar'; | ||
import { ReactNode } from 'react'; | ||
|
||
export default function layout({ children }: { children: ReactNode }) { | ||
// track progress with onboarding context | ||
return ( | ||
<> | ||
<ProgressBar | ||
steps={new Set(['Basic Info', 'Languages', 'Legal Experience', 'Done'])} | ||
progress={2} | ||
/> | ||
{children} | ||
<BigButton>Continue</BigButton> | ||
</> | ||
); | ||
} |
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,6 @@ | ||
import React from 'react'; | ||
|
||
// temporary placeholder | ||
export default function page() { | ||
return <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
This file was deleted.
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