Skip to content

Commit

Permalink
Create the Login component and reuse the register component's scss in…
Browse files Browse the repository at this point in the history
… login component
  • Loading branch information
abhishekram404 committed Mar 10, 2022
1 parent 0e9ab06 commit 4d8f342
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/app/Interfaces/ILogin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface ILogin{

}
2 changes: 2 additions & 0 deletions src/app/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Cart from "app/components/Cart/Cart";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import PageNotFound from "app/components/PageNotFound/PageNotFound";
import Register from "app/components/Register/Register";
import Login from "app/components/Login/Login";
const Layout = React.memo(() => {
return (
<Router>
Expand All @@ -15,6 +16,7 @@ const Layout = React.memo(() => {
<Routes>
<Route path="/" element={<Homepage />} />
<Route path="/register" element={<Register />} />
<Route path="/login" element={<Login />} />
<Route path="/cart" element={<Cart />} />
<Route path="*" element={<PageNotFound />} />
</Routes>
Expand Down
17 changes: 17 additions & 0 deletions src/app/components/Login/Login.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.login {
min-height: 80vh;
padding: 40px 20px;
display: flex;
justify-content: center;
align-items: center;
}

.form {
border: 1px solid rgba($color: #000000, $alpha: 0.1);
padding: 20px;
}

.formTitle {
font-family: "Cabin", sans-serif;
margin-bottom: 10px;
}
3 changes: 3 additions & 0 deletions src/app/components/Login/Login.module.scss.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const login: string;
export const form: string;
export const formTitle: string;
30 changes: 30 additions & 0 deletions src/app/components/Login/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { useState } from "react";
import styles from "app/components/Register/Register.module.scss";
import InputLabelGroup from "../InputLabelGroup/InputLabelGroup";
import { Formik, Form } from "formik";
import PrimaryButton from "app/components/Buttons/PrimaryButton/PrimaryButton";
const Login = () => {
const initialValues = { email: "", password: "" };
const [formData, setFormData] = useState(initialValues);

return (
<Formik
initialValues={initialValues}
onSubmit={(values) => setFormData(values)}
>
<div className={styles.login}>
<Form className={styles.form}>
<h2 className={styles.formTitle}>Login</h2>
<p className={styles.formDescription}>
Please login to unleash the features of WooleSale that only true
customers can have.
</p>
<InputLabelGroup name="email" label="Email" type="email" />
<InputLabelGroup name="password" label="Password" type="password" />
<PrimaryButton type="submit">Login</PrimaryButton>
</Form>
</div>
</Formik>
);
};
export default Login;
16 changes: 14 additions & 2 deletions src/app/components/Register/Register.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
padding: 40px 20px;
gap: 20px;
}
.login {
min-height: 80vh;
display: flex;
justify-content: center;
padding: 40px 20px;
align-items: center;
min-width: 270px;
max-width: 500px;
margin: auto;
}

.form {
border: 1px solid rgba($color: #000000, $alpha: 0.1);
Expand Down Expand Up @@ -58,15 +68,17 @@
}
}
@media only screen and(max-width:425px) {
.register {
.register,
.login {
padding: 20px;
}
.helperSection {
width: 100%;
}
}
@media only screen and(max-width:375px) {
.register {
.register,
.login {
padding: 10px;
}
}
1 change: 1 addition & 0 deletions src/app/components/Register/Register.module.scss.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const register: string;
export const login: string;
export const form: string;
export const formTitle: string;
export const formDescription: string;
Expand Down

1 comment on commit 4d8f342

@vercel
Copy link

@vercel vercel bot commented on 4d8f342 Mar 10, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.