Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit Login/Signup with Enter Key #211

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions frontend/src/components/forms/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ const Login = ({
}
};

const onLoginClick = async () => {
const onLoginClick = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥶

setLoginClicked(true);

if (emailError || generalError) {
Expand Down Expand Up @@ -157,6 +158,7 @@ const Login = ({

if (toggle) {
return (
<form onSubmit={onLoginClick}>
<Flex h="100vh">
<Box w="47%">
<Flex
Expand Down Expand Up @@ -214,7 +216,6 @@ const Login = ({
}
: {}
}
onClick={onLoginClick}
>
Log In
</Button>
Expand All @@ -236,6 +237,7 @@ const Login = ({
{/* Background */}
</Box>
</Flex>
</form>
);
}
return <></>;
Expand Down
34 changes: 18 additions & 16 deletions frontend/src/components/forms/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ const Signup = ({
}
};

const onSignupClick = async () => {
const onSignupClick = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
setSignupClicked(true);

if (firstNameError || lastNameError || emailError || generalError) {
Expand Down Expand Up @@ -207,6 +208,7 @@ const Signup = ({

if (toggle) {
return (
<form onSubmit={onSignupClick}>
<Flex h="100vh">
<Box w="47%">
<Flex
Expand Down Expand Up @@ -280,13 +282,12 @@ const Signup = ({
_hover={
email && password && firstName && lastName
? {
background: "teal.500",
transition:
"transition: background-color 0.5s ease !important",
}
background: "teal.500",
transition:
"transition: background-color 0.5s ease !important",
}
: {}
}
onClick={onSignupClick}
>
Create Account
</Button>
Expand All @@ -297,17 +298,18 @@ const Signup = ({
<Text variant="loginSecondary" paddingRight="1.1vw">
Already have an account?
</Text>
<Text variant="loginTertiary" onClick={onLogInClick}>
Log In Now
<Text variant="loginTertiary" onClick={onLogInClick}>
Log In Now
</Text>
</Flex>
</Box>
</Flex>
</Box>
<Box flex="1" bg="teal.400">
{/* Background */}
</Box>
</Flex>
</Flex>
</Box>
</Flex>
</Box>
<Box flex="1" bg="teal.400">
{/* Background */}
</Box>
</Flex>
</form>
);
}
return <></>;
Expand Down
Loading