Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log in and Signup pages added #142

Merged
merged 7 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"node-sass": "^7.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.3.1",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.0"
},
"scripts": {
Expand Down
34 changes: 17 additions & 17 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const App = () => {
ProfilePicture: {
Set: false,
ProfileImage:
"https://cdn.nerdschalk.com/wp-content/uploads/2020/09/how-to-remove-profile-picture-on-zoom-12.png?width=150"
}
"https://cdn.nerdschalk.com/wp-content/uploads/2020/09/how-to-remove-profile-picture-on-zoom-12.png?width=150",
},
},
Experience: [],
Education: [],
Expand All @@ -38,7 +38,7 @@ const App = () => {
const SetSection = (Section, Content) => {
setAppState({
...appState,
Resume: { ...appState.Resume, [Section]: Content }
Resume: { ...appState.Resume, [Section]: Content },
Copy link
Member

Choose a reason for hiding this comment

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

Configure prettier to not have trailing commas.

});
};
const SetSwitch = () => {
Expand All @@ -50,16 +50,16 @@ const App = () => {
...appState.Resume.About,
ProfilePicture: {
...appState.Resume.About.ProfilePicture,
Set: !(appState.Resume.About.ProfilePicture.Set)
}
}
}
})
Set: !appState.Resume.About.ProfilePicture.Set,
},
},
},
});
Copy link
Member

Choose a reason for hiding this comment

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

Configure prettier to not have trailing commas.

};
const ImageHandler = (e) => {
const reader = new FileReader();
reader.onload = () => {
if(reader.readyState === 2){
if (reader.readyState === 2) {
setAppState({
...appState,
Resume: {
Expand All @@ -68,15 +68,15 @@ const App = () => {
...appState.Resume.About,
ProfilePicture: {
...appState.Resume.About.ProfilePicture,
ProfileImage: reader.result
}
}
}
})
ProfileImage: reader.result,
},
},
},
Copy link
Member

Choose a reason for hiding this comment

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

Configure prettier to not have trailing commas.

});
}
}
reader.readAsDataURL(e.target.files[0])
}
};
reader.readAsDataURL(e.target.files[0]);
};
return (
<div className="rezume">
<Header
Expand Down
6 changes: 5 additions & 1 deletion src/components/Header/Header.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from "react";
import NavLink from "./_NavLink";
import { Link } from "react-router-dom";

const Header = ({ ChangePage, CurrentPage, Resume }) => {
return (
<nav className="navbar navbar-expand navbar-dark justify-content-between rezume-header">
<span className="navbar-brand mb-0 h1 col-1">Rezume</span>
<ul className="navbar-nav">
{Object.keys(Resume).map(NavItem => (
{Object.keys(Resume).map((NavItem) => (
Copy link
Member

Choose a reason for hiding this comment

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

Configure prettier to not have extra parentheses.

<NavLink
Name={NavItem}
Active={CurrentPage === NavItem}
Expand All @@ -15,6 +16,9 @@ const Header = ({ ChangePage, CurrentPage, Resume }) => {
/>
))}
</ul>
<Link to="/login" className="btn btn-primary btn-sm col-1">
Login
</Link>
<a
href="https://rezyume.co/"
target="_blank"
Expand Down
21 changes: 14 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./components/App";

import "./styles/App.scss";
import App from "./components/App.js";
import Login from "./pages/LoginPage";
import Signup from "./pages/SignupPage";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import * as serviceWorker from "./serviceWorker";

ReactDOM.render(<App />, document.getElementById("root"));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
ReactDOM.render(
<Router>
<Routes>
<Route exact path="/" element={<App />}></Route>
<Route path="/login" element={<Login />}></Route>
<Route path="/signup" element={<Signup />}></Route>
Comment on lines +13 to +15
Copy link
Member

Choose a reason for hiding this comment

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

Can we use component instead of element and self close the <Route />?

</Routes>
</Router>,
document.getElementById("root")
);
serviceWorker.unregister();
58 changes: 58 additions & 0 deletions src/pages/LoginPage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from "react";
import "./index.scss";
Copy link
Member

Choose a reason for hiding this comment

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

Put the SCSS in the right directory and do not import it this way.

import { Link } from "react-router-dom";

function Login() {
const [email, setEmail] = React.useState("");
const [password, setPassword] = React.useState("");
const [emailError, setEmailError] = React.useState("");
const [passwordError, setPasswordError] = React.useState("");

function handleSubmit() {
if (email === "") {
setEmailError("Required");
} else {
setEmailError("");
}
if (password === "") {
setPasswordError("No Password provided");
} else {
setPasswordError("");
}
}

return (
<div className="container">
<form className="loginform">
<h1>Log In</h1>
<input
className="inputEmail"
type="email"
placeholder="Email"
autocomplete="off"
onChange={(e) => setEmail(e.target.value)}
required
/>
<p className="alert">{emailError}</p>
<input
className="inputPassword"
type="password"
placeholder="Password"
autocomplete="off"
onChange={(e) => setPassword(e.target.value)}
required
/>
<p className="alert">{passwordError}</p>
<input
className="inputSubmit"
type="submit"
value="Login"
onClick={handleSubmit}
/>
<Link to="/Signup">New User ?</Link>
Copy link
Member

Choose a reason for hiding this comment

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

Remove space before ?.

</form>
</div>
);
}

export default Login;
47 changes: 47 additions & 0 deletions src/pages/LoginPage/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.loginform {
background-color: #003100;
padding: 2rem;
height: 400px;
}
.inputSubmit {
background-color: #0000ff;
color: white;
margin-left: 1rem;
border-radius: 10px;
width: 100px;
outline-width: 0;
margin-right: 20px;
margin-top: 20px;
Comment on lines +9 to +14
Copy link
Member

Choose a reason for hiding this comment

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

Better and concise CSS?

}

.Submit-form {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
}
h1 {
color: greenyellow;
}
.alert {
color: red;
text-align: left;
margin: 0px;
margin-left: 12rem;
padding: 0px;
}
.inputEmail {
margin-bottom: 0px;
border-radius: 10px;
outline-width: 0;
width: 350px;
padding: 0.4rem;
}
.inputPassword {
margin-bottom: 0px;
border-radius: 10px;
outline-width: 0;
width: 350px;
padding: 0.4rem;
margin-top: 20px;
}
Comment on lines +33 to +47
Copy link
Member

Choose a reason for hiding this comment

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

Better CSS?

Loading