Skip to content

Commit d33b6df

Browse files
committed
Add signup page
1 parent e70717b commit d33b6df

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { Grid, TextInput, Button, PasswordInput, Divider, Text, Image } from "@mantine/core";
2+
import { useForm } from "@mantine/form";
3+
import { Link } from "react-router";
4+
import logo from "../assets/images/logo.svg";
5+
6+
export function meta() {
7+
return [
8+
{ title: "PeerPrep - Signup" },
9+
{ name: "description", content: "Welcome to PeerPrep!" },
10+
];
11+
}
12+
13+
export default function Signup() {
14+
const form = useForm({
15+
initialValues: {
16+
email: "",
17+
username: "",
18+
password: "",
19+
},
20+
21+
validate: {
22+
email: (value) => (/^\S+@\S+$/.test(value) ? null : "Invalid email"),
23+
password: (value) =>
24+
value.length < 6 ? "Password must be at least 6 characters" : null,
25+
},
26+
});
27+
28+
return (
29+
<Grid>
30+
<Grid.Col span={12}>
31+
<Grid justify="center" gutter={"xs"} mt={{ base: 20, md: 200 }}>
32+
<Grid.Col span={{ base: 12, md: 4 }}>
33+
<Image src={logo} alt="PeerPrep Logo" />
34+
<form onSubmit={form.onSubmit((values) => console.log(values))}>
35+
<Grid.Col span={12}>
36+
<TextInput
37+
label="Email"
38+
placeholder="Enter your email"
39+
type="email"
40+
key={form.key("email")}
41+
{...form.getInputProps('email')}
42+
error={undefined}
43+
/>
44+
</Grid.Col>
45+
<Grid.Col span={12}>
46+
<TextInput
47+
label="Username"
48+
placeholder="Enter your Username"
49+
type="text"
50+
key={form.key("username")}
51+
{...form.getInputProps('username')}
52+
error={undefined}
53+
/>
54+
</Grid.Col>
55+
<Grid.Col span={12}>
56+
<PasswordInput
57+
label="Password"
58+
placeholder="Enter your password"
59+
type="password"
60+
key={form.key("password")}
61+
{...form.getInputProps('password')}
62+
/>
63+
</Grid.Col>
64+
<Grid.Col span={12} mt="md">
65+
<Button type="submit" fullWidth autoContrast>
66+
Login
67+
</Button>
68+
</Grid.Col>
69+
</form>
70+
<Grid.Col span={12} mt="md">
71+
<Divider my="xs" />
72+
</Grid.Col>
73+
<Grid.Col span={12} mt="md" className="text-center">
74+
<Text span>Already have an account? </Text><Link to="/login"><Text span td="underline" c="blue" className="cursor-pointer">Log in!</Text></Link>
75+
</Grid.Col>
76+
</Grid.Col>
77+
</Grid>
78+
</Grid.Col>
79+
</Grid>
80+
);
81+
}

0 commit comments

Comments
 (0)