Skip to content

Commit 2caf0a2

Browse files
mshi672harbassan
andauthored
Vps/login page polishing (#332)
* feat: used nicer diamond button for log in button * fix: login button renaming * fix: login page now responsive to dark/light mode * fix: lint and prettier passed * fix: tiny tailwind inconsistencies --------- Co-authored-by: harbassan <[email protected]>
1 parent cd9a950 commit 2caf0a2

File tree

2 files changed

+107
-37
lines changed

2 files changed

+107
-37
lines changed
Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
import { useContext, useEffect } from "react";
22
import { useHistory, useLocation } from "react-router-dom";
3+
import DiamondLoginButton from "../components/DiamondLoginButton";
34
import AuthenticationContext from "context/AuthenticationContext";
45

56
import toast from "react-hot-toast";
6-
import axios from "axios";
7+
import { api } from "../../../util/api";
78

89
const handleSignIn = async (user) => {
9-
const token = await user.getIdToken();
10-
const config = {
11-
method: "post",
12-
url: `api/user/`,
13-
headers: { Authorization: `Bearer ${token}` },
14-
data: {
15-
name: user.displayName,
16-
uid: user.uid,
17-
email: user.email,
18-
pictureURL: user.photoURL,
19-
},
10+
const data = {
11+
name: user.displayName,
12+
uid: user.uid,
13+
email: user.email,
14+
pictureURL: user.photoURL,
2015
};
21-
return axios.request(config);
16+
api.post(user, "api/user", data);
2217
};
2318

2419
export default function LoginPage() {
@@ -50,41 +45,29 @@ export default function LoginPage() {
5045
return (
5146
<div className="min-h-screen flex flex-col">
5247
{/* Top whitespace */}
53-
<div style={{ height: "var(--spacing-2xl-3xl)" }} />
48+
<div className="h-2xl-3xl" />
5449

5550
{/* Main container */}
5651
<div className="u-container u-grid flex-grow w-full">
5752
{/* Grid container for left/right split */}
58-
<div
59-
className="u-grid w-full flex-grow"
60-
style={{ gridTemplateColumns: "636fr 304fr", height: "100%" }}
61-
>
53+
<div className="u-grid w-full flex-grow h-full grid-cols-[636fr_304fr]">
6254
{/* Left container */}
6355
<div className="flex flex-col justify-between h-full">
6456
{/* Top-left text */}
65-
<div
66-
className="text-left font-ibm"
67-
style={{
68-
fontSize: "clamp(92px, 5vw, 105px)",
69-
lineHeight: "clamp(102px, 5.5vw, 115px)",
70-
}}
71-
>
57+
<div className="text-left font-dm text-[clamp(92px,5vw,105px)]/[clamp(102px,5.5vw,115px)]">
7258
<div>Virtual</div>
7359
<div>Patient</div>
7460
<div>Simulator</div>
7561
</div>
7662

7763
{/* Bottom-left text */}
78-
<div
79-
className="text-left font-ibm text-s"
80-
style={{ color: "var(--color-grey)" }}
81-
>
64+
<div className="text-left font-dm text-s text-primary">
8265
<div>Crafted by many hands,</div>
8366
<div>across many teams,</div>
8467
<div>
8568
over many years at{" "}
8669
<a
87-
className="underline decoration-1 underline-offset-2 hover:text-white"
70+
className="underline decoration-1 underline-offset-2 hover:text-secondary"
8871
href="https://wdcc.co.nz/"
8972
target="_blank"
9073
rel="noreferrer"
@@ -100,28 +83,26 @@ export default function LoginPage() {
10083
<div className="flex flex-col justify-between h-full">
10184
{/* Centered diamond button */}
10285
<div className="flex-grow flex justify-center items-center">
103-
<button
104-
className="btn vps-diamond"
86+
<DiamondLoginButton
87+
size={150}
10588
onClick={() => {
10689
if (!loading && !user) {
10790
signInUsingGoogle();
10891
}
10992
}}
110-
>
111-
<span>LOG IN</span>
112-
</button>
93+
/>
11394
</div>
11495

11596
{/* Bottom-aligned text */}
116-
<div className="font-ibm text-s text-center">
97+
<div className="font-dm text-s text-center">
11798
Please use your university account.
11899
</div>
119100
</div>
120101
</div>
121102
</div>
122103

123104
{/* Bottom whitespace */}
124-
<div style={{ height: "var(--spacing-3xl-4xl)" }} />
105+
<div className="h-3xl-4xl" />
125106
</div>
126107
);
127108
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
const DiamondPlayButton = ({ size = 100, onClick }) => {
2+
// Make size responsive to viewport
3+
const responsiveSize = `clamp(80px, ${size * 0.06}vw, ${size}px)`;
4+
5+
return (
6+
<>
7+
<style>{`
8+
/* Diamond login Button Styles */
9+
.diamond-login-button:hover {
10+
transform: scale(1.1);
11+
}
12+
13+
.diamond-shape {
14+
position: absolute;
15+
top: 0;
16+
left: 0;
17+
right: 0;
18+
bottom: 0;
19+
background-color: var(--color-base-100);
20+
border: 1px solid var(--color-primary);
21+
transform: rotate(45deg);
22+
transition: all 0.3s ease-out;
23+
border-radius: 2px;
24+
}
25+
26+
.diamond-login-button:hover .diamond-shape {
27+
box-shadow: 0 0px 32px 8px rgba(var(--color-base-content-rgb), 0.20);
28+
border-color: var(--color-base-content);
29+
background-color: var(--color-base-content);
30+
}
31+
32+
.diamond-login-button:active .diamond-shape {
33+
transform: rotate(45deg) scale(0.95);
34+
}
35+
36+
.diamond-login-button:hover .login-text {
37+
color: var(--color-base-100) !important;
38+
text-shadow: 0 0 8px rgba(var(--color-base-content-rgb), 0.8);
39+
}
40+
`}</style>
41+
<div
42+
className="diamond-login-button"
43+
onClick={onClick}
44+
style={{
45+
width: responsiveSize,
46+
height: responsiveSize,
47+
position: "relative",
48+
cursor: "pointer",
49+
userSelect: "none",
50+
transition: "all 0.3s ease-out",
51+
}}
52+
>
53+
{/* Diamond Shape */}
54+
<div
55+
className="diamond-shape"
56+
style={{
57+
transformOrigin: "center center",
58+
}}
59+
/>
60+
61+
{/* Play Text */}
62+
<div
63+
className="login-text"
64+
style={{
65+
fontSize: `clamp(12px, ${size * 0.012}vw, ${size * 0.2}px)`,
66+
position: "absolute",
67+
top: 0,
68+
left: 0,
69+
right: 0,
70+
bottom: 0,
71+
display: "flex",
72+
alignItems: "center",
73+
justifyContent: "center",
74+
color: "var(--color-base-content)",
75+
fontWeight: "regular",
76+
letterSpacing: "0.05em",
77+
transition: "all 0.2s ease-out",
78+
pointerEvents: "none",
79+
fontFamily: "var(--font-dm)",
80+
}}
81+
>
82+
LOG IN
83+
</div>
84+
</div>
85+
</>
86+
);
87+
};
88+
89+
export default DiamondPlayButton;

0 commit comments

Comments
 (0)