Skip to content

Commit

Permalink
Merge pull request #23 from marbiano/auth-forms
Browse files Browse the repository at this point in the history
Auth forms
  • Loading branch information
okbel committed Oct 27, 2020
2 parents 1c2ce11 + c2ce373 commit c44ba9f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
13 changes: 9 additions & 4 deletions components/auth/ForgotPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const ForgotPassword: FC<Props> = () => {

const { setModalView, closeModal } = useUI()

const handleSignup = async () => {
const handleResetPassword = async (e: React.SyntheticEvent<EventTarget>) => {
e.preventDefault()

if (!dirty && !disabled) {
setDirty(true)
handleValidation()
Expand All @@ -34,7 +36,10 @@ const ForgotPassword: FC<Props> = () => {
}, [handleValidation])

return (
<div className="w-80 flex flex-col justify-between p-3">
<form
onSubmit={handleResetPassword}
className="w-80 flex flex-col justify-between p-3"
>
<div className="flex justify-center pb-12 ">
<Logo width="64px" height="64px" />
</div>
Expand All @@ -47,7 +52,7 @@ const ForgotPassword: FC<Props> = () => {
<div className="pt-2 w-full flex flex-col">
<Button
variant="slim"
onClick={() => handleSignup()}
type="submit"
loading={loading}
disabled={disabled}
>
Expand All @@ -66,7 +71,7 @@ const ForgotPassword: FC<Props> = () => {
</a>
</span>
</div>
</div>
</form>
)
}

Expand Down
13 changes: 9 additions & 4 deletions components/auth/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const LoginView: FC<Props> = () => {

const login = useLogin()

const handleLogin = async () => {
const handleLogin = async (e: React.SyntheticEvent<EventTarget>) => {
e.preventDefault()

if (!dirty && !disabled) {
setDirty(true)
handleValidation()
Expand Down Expand Up @@ -54,7 +56,10 @@ const LoginView: FC<Props> = () => {
}, [handleValidation])

return (
<div className="w-80 flex flex-col justify-between p-3">
<form
onSubmit={handleLogin}
className="w-80 flex flex-col justify-between p-3"
>
<div className="flex justify-center pb-12 ">
<Logo width="64px" height="64px" />
</div>
Expand All @@ -75,7 +80,7 @@ const LoginView: FC<Props> = () => {

<Button
variant="slim"
onClick={() => handleLogin()}
type="submit"
loading={loading}
disabled={disabled}
>
Expand All @@ -92,7 +97,7 @@ const LoginView: FC<Props> = () => {
</a>
</div>
</div>
</div>
</form>
)
}

Expand Down
13 changes: 9 additions & 4 deletions components/auth/SignUpView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const SignUpView: FC<Props> = () => {
const signup = useSignup()
const { setModalView, closeModal } = useUI()

const handleSignup = async () => {
const handleSignup = async (e: React.SyntheticEvent<EventTarget>) => {
e.preventDefault()

if (!dirty && !disabled) {
setDirty(true)
handleValidation()
Expand Down Expand Up @@ -59,7 +61,10 @@ const SignUpView: FC<Props> = () => {
}, [handleValidation])

return (
<div className="w-80 flex flex-col justify-between p-3">
<form
onSubmit={handleSignup}
className="w-80 flex flex-col justify-between p-3"
>
<div className="flex justify-center pb-12 ">
<Logo width="64px" height="64px" />
</div>
Expand All @@ -83,7 +88,7 @@ const SignUpView: FC<Props> = () => {
<div className="pt-2 w-full flex flex-col">
<Button
variant="slim"
onClick={() => handleSignup()}
type="submit"
loading={loading}
disabled={disabled}
>
Expand All @@ -102,7 +107,7 @@ const SignUpView: FC<Props> = () => {
</a>
</span>
</div>
</div>
</form>
)
}

Expand Down

0 comments on commit c44ba9f

Please sign in to comment.