-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from NUS-Fintech-Society/feature/TAS-1-Login-Form
Feature/tas 1 login form
- Loading branch information
Showing
14 changed files
with
217 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.container { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; /* Example to fill the screen */ | ||
background: linear-gradient(180deg, #0C1747 0%, rgba(37, 60, 92, 0.62) 100%); | ||
border: 1px black solid; | ||
} |
108 changes: 108 additions & 0 deletions
108
src/assets/css/authentication/LoginFormComponent.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
@import url("https://fonts.cdnfonts.com/css/dm-sans"); | ||
|
||
.login { | ||
width: 70%; | ||
background-color: white; | ||
border-radius: 4px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
font-family: "DM Sans", sans-serif; | ||
} | ||
|
||
.login-image { | ||
width: 0%; | ||
} | ||
|
||
.login-form { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.login-form > * { | ||
margin-bottom: 25px; | ||
} | ||
|
||
.login-form > p { | ||
font-size: 40px; | ||
font-weight: bold; | ||
margin-top: 20px; | ||
} | ||
|
||
.login-form > input { | ||
outline: none; | ||
border: none; | ||
height: 45%; | ||
width: 80%; | ||
border-radius: 7px; | ||
padding: 12px; | ||
background-color: #d9d9d9; | ||
font-family: "DM Sans"; | ||
font-size: 20px; | ||
} | ||
|
||
.login-form > input::placeholder { | ||
color: #fff; | ||
font-family: "DM Sans"; | ||
font-size: 20px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: normal; | ||
text-align: left; | ||
} | ||
|
||
.forgot-password { | ||
color: #151515; | ||
font-family: "DM Sans"; | ||
font-size: 15px; | ||
text-decoration: underline; | ||
} | ||
|
||
.login-button-container { | ||
width: 30%; | ||
height: auto; | ||
border-radius: 7px; | ||
margin: auto; | ||
} | ||
|
||
.password-visibility-button { | ||
position: relative; | ||
bottom: 60px; | ||
left: 30%; | ||
margin: 0; | ||
} | ||
|
||
.sign-in-button { | ||
/* put in container */ | ||
height: 100%; | ||
width: 35%; | ||
padding: 10px; | ||
border-radius: 7px; | ||
|
||
color: #fff; | ||
background-color: #0c1747 !important; | ||
font-family: "DM Sans"; | ||
font-size: 20px; | ||
text-align: center; | ||
cursor: pointer; | ||
} | ||
|
||
/* For desktops */ | ||
@media (min-width: 992px) { | ||
.login { | ||
max-width: 1037px; | ||
background-color: white; | ||
border-radius: 4px; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
font-family: "DM Sans", sans-serif; | ||
} | ||
|
||
.login-image { | ||
width: 50%; | ||
height: 100%; | ||
} | ||
} |
50 changes: 0 additions & 50 deletions
50
src/assets/css/authentication/MobileLoginContainer.module.css
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
src/assets/css/authentication/WebLoginContainer.module.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import styles from '../../assets/css/authentication/LoginContainer.module.css'; // Import web-specific CSS | ||
import LoginFormComponent from "components/authentication/LoginFormComponent.tsx"; | ||
|
||
const WebLoginContainer = () => { | ||
return ( | ||
<div className={styles.container}> | ||
<LoginFormComponent/> | ||
</div> | ||
); | ||
} | ||
|
||
export default WebLoginContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { useState } from "react"; | ||
import { useForm, SubmitHandler } from "react-hook-form"; | ||
import { Icon } from "@iconify/react"; | ||
|
||
import styles from "css/authentication/LoginFormComponent.module.css"; | ||
import loginImage from "/login-image.svg"; | ||
import { signIn } from "@/api/authentication.ts"; | ||
|
||
type Inputs = { | ||
email: string, | ||
password: string | ||
} | ||
|
||
const LoginFormComponent = () => { | ||
const [showPassword, setShowPassword] = useState<boolean>(false); | ||
|
||
const { | ||
register, | ||
handleSubmit, | ||
} = useForm<Inputs>(); | ||
const onSubmit: SubmitHandler<Inputs> = (data) => signIn(data.email, data.password); | ||
|
||
const changePasswordVisibility = () => { | ||
setShowPassword((prev) => !prev); | ||
}; | ||
|
||
return ( | ||
<div className={styles.login}> | ||
<img src={loginImage} alt="login-image" className={styles["login-image"]} /> | ||
<form className={styles["login-form"]} onSubmit={handleSubmit(onSubmit)}> | ||
<p>Login</p> | ||
<input type="text" placeholder="Email" {...register("email", {required: true })} /> | ||
<input | ||
type={showPassword ? "text" : "password"} | ||
placeholder="Password" | ||
{...register("password", {required: true })} | ||
/> | ||
<button className={styles["password-visibility-button"]} onClick={changePasswordVisibility}> | ||
{showPassword ? <Icon icon="mdi:eye" style={{color: "white" }} /> : <Icon icon="mdi:eye-off" style={{color: "white" }} />} | ||
</button> | ||
<a href="" className={styles["forgot-password"]}> | ||
Forgot your password? | ||
</a> | ||
|
||
<input type="submit" className={styles["sign-in-button"]} value="Sign In" /> | ||
</form> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoginFormComponent; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
import { useWindowSize } from "@uidotdev/usehooks"; | ||
|
||
import MobileLoginContainer from "components/authentication/MobileLoginContainer.tsx"; | ||
import WebLoginContainer from "components/authentication/WebLoginContainer.tsx"; | ||
import { BREAKPOINTS } from "components/constants.tsx"; | ||
|
||
import LoginContainer from "@/components/authentication/LoginContainer"; | ||
|
||
const App = () => { | ||
const size = useWindowSize(); | ||
return size.width && size.width <= BREAKPOINTS.MD ? <MobileLoginContainer/> : <WebLoginContainer/>; | ||
return <LoginContainer />; | ||
}; | ||
|
||
export default App | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters