Skip to content

Commit b65f1bc

Browse files
committed
Implement login, update logo
* Implement new Login component - form, styles, functionality - Use register css for styles - Change .register to .accountForm * Create Dashboard component file * Change logo from Borum logo to Sphere logo (a sphere) and update alt accordingly v0.2.0
1 parent 52f5e72 commit b65f1bc

10 files changed

Lines changed: 106 additions & 39 deletions

File tree

package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "borum-sphere",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "The web app for Borum users to read, update, delete, and create their account and the Borum products that they're using",
55
"private": true,
66
"dependencies": {
7-
"@testing-library/jest-dom": "^5.11.8",
8-
"@testing-library/react": "^11.2.3",
9-
"@testing-library/user-event": "^12.6.0",
7+
"@testing-library/jest-dom": "^5.11.9",
8+
"@testing-library/react": "^11.2.5",
9+
"@testing-library/user-event": "^12.7.1",
1010
"react": "^17.0.1",
1111
"react-dom": "^17.0.1",
1212
"react-scripts": "4.0.1",

public/icon.png

232 KB
Loading

public/logo192.png

228 KB
Loading

public/logo512.png

224 KB
Loading

src/Dashboard/dashboard.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default function Dashboard() {
2+
return (
3+
<article>
4+
<h1>Borum Sphere Dashboard</h1>
5+
<h2>Full Name</h2>
6+
7+
8+
9+
</article>
10+
);
11+
}

src/Login/login.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import login from "../Register/register.module.css";
2+
import FormField from "../FormField/formField";
3+
import { useState } from "react";
4+
import LogoImage from "../LogoImage";
5+
6+
export default function Login() {
7+
const [email, setEmail] = useState("");
8+
const [password, setPassword] = useState("");
9+
10+
const handleLogin = e => {
11+
e.preventDefault();
12+
13+
fetch("https://api.bforborum.com/api/login", {
14+
method: "POST",
15+
headers: {
16+
"content-type": "application/x-www-form-urlencoded",
17+
},
18+
body: `email=${email}&password=${password}`,
19+
})
20+
.then(response => response.json())
21+
.then(response => {
22+
if (response.statusCode >= 200 && response.statusCode < 300) {
23+
} else {
24+
alert(
25+
"A system error occurred and you could not be logged in. "
26+
);
27+
}
28+
});
29+
};
30+
31+
return (
32+
<main className={login.accountForm}>
33+
<h1>Login into Borum</h1>
34+
<LogoImage />
35+
<form onSubmit={handleLogin} method="post" className={login.form}>
36+
<FormField
37+
autofocus
38+
label="email"
39+
format="email"
40+
required
41+
value={email}
42+
onChange={e => setEmail(e.target.value)}
43+
/>
44+
<FormField
45+
label="password"
46+
format="password"
47+
required
48+
value={password}
49+
onChange={e => setPassword(e.target.value)}
50+
/>
51+
<a
52+
target="_blank"
53+
rel="noreferrer"
54+
href="http://forum.bforborum.com/reset_password"
55+
>
56+
Forgot password? Reset it
57+
</a>
58+
<button type="submit" className={login.card}>
59+
Login
60+
</button>
61+
</form>
62+
</main>
63+
);
64+
}

src/LogoImage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function LogoImage() {
2+
return <img src="/icon.png" height="100" alt="The Borum Sphere logo" />;
3+
}

src/Register/register.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import register from "./register.module.css";
22
import FormField from "../FormField/formField";
33
import { useState } from "react";
4+
import LogoImage from "../LogoImage";
45

56
export default function Register() {
67
const [email, setEmail] = useState("");
@@ -33,19 +34,16 @@ export default function Register() {
3334
setConfirmPassword("");
3435
setFirstName("");
3536
setLastName("");
36-
alert("You were successfully registered! Welcome to Borum!");
37+
3738
} else {
3839
alert("A system error occurred and you could not be registered. We apologize for the inconvenience. ");
3940
}
4041
});
4142
};
4243

4344
return (
44-
<div className={register.register}>
45-
<img
46-
src="/icon.png"
47-
alt="The Borum Logo, a B inside a black-bordered, white rectangle"
48-
/>
45+
<div className={register.accountForm}>
46+
<LogoImage />
4947
<h1>Register for Borum</h1>
5048
<form onSubmit={handleRegister} method="post" className={register.form}>
5149
<FormField
@@ -86,13 +84,7 @@ export default function Register() {
8684
format="password"
8785
label="Confirm Password"
8886
/>
89-
<a
90-
target="_blank"
91-
rel="noreferrer"
92-
href="http://forum.bforborum.com/reset_password"
93-
>
94-
Forgot password? Reset it
95-
</a>
87+
9688
<button type="submit" className={register.card}>
9789
Register
9890
</button>

src/Register/register.module.css

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,21 @@
4242
Bitstream Vera Sans Mono, Courier New, monospace;
4343
}
4444

45-
.register {
45+
.accountForm {
4646
display: flex;
4747
align-items: center;
4848
justify-content: center;
4949
flex-direction: column;
5050
max-width: 500px;
5151
width: 90%;
5252
margin-top: 2rem;
53+
border: 1px solid gainsboro;
54+
padding: 1em;
55+
width: 100%;
56+
text-align: center;
5357
}
5458

55-
.register h1 {
59+
.accountForm h1 {
5660
font-weight: normal;
5761
font-size: 1.5rem;
5862
}
@@ -122,10 +126,3 @@
122126
font-size: 16px;
123127
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
124128
}
125-
126-
.register {
127-
border: 1px solid gainsboro;
128-
padding: 1em;
129-
width: 100%;
130-
text-align: center;
131-
}

0 commit comments

Comments
 (0)