diff --git a/src/Main.js b/src/Main.js index fd3fed4..0878f96 100644 --- a/src/Main.js +++ b/src/Main.js @@ -6,10 +6,14 @@ import Dashboard from './pages/Dashboard' import AboutUs from './pages/About-Us' import Privacy from './pages/Privacy' import Settings from './pages/Settings' -import Support from './pages/Support' +import Login from './pages/Login' +import Signup from './pages/Signup' import ContactUs from './pages/Contact-Us' import Welcome from './pages/Welcome' import Error from './pages/Error-Page' + +import checkLogin from './utils/utils.js' + import './styles.css' export default function Main() { @@ -40,7 +44,15 @@ export default function Main() { case "/welcome": Layout = Welcome break; - + + case "/login": + Layout = Login + break; + + case "/signup": + Layout = Signup + break; + default: Layout = Error break; @@ -49,7 +61,7 @@ export default function Main() { return (
- {window.location.pathname != "/welcome" ? + {checkLogin() ?
diff --git a/src/components/NavBar.css b/src/components/NavBar.css index 1de027e..276bea0 100644 --- a/src/components/NavBar.css +++ b/src/components/NavBar.css @@ -15,6 +15,10 @@ color: inherit; } +.nav-brand:hover { + color: inherit; +} + .nav-login-control { display: flex; margin-left: auto; diff --git a/src/components/NavBar.js b/src/components/NavBar.js index a060db8..a07ff9d 100644 --- a/src/components/NavBar.js +++ b/src/components/NavBar.js @@ -4,6 +4,7 @@ import { Toolbar, Typography, Button, IconButton, Link } from "@material-ui/core import AccountCircle from '@mui/icons-material/AccountCircle'; import logo from "../assets/BudgetBuddyLogo.png" import "./NavBar.css" +import checkLogin from "../utils/utils"; export default function NavBar() { const [auth, setAuth] = React.useState(true); @@ -12,11 +13,19 @@ export default function NavBar() { const handleLogin = () => { setAuth(true); handleClose(); + window.location.href='/login'; + } + + const handleSignup = () => { + setAuth(true); + handleClose(); + window.location.href='/signup' } const handleLogout= () => { setAuth(false); handleClose(); + window.location.href='/welcome' } const handleMenu = (event) => { @@ -38,7 +47,7 @@ export default function NavBar() {
- {auth + {!checkLogin ? // Logged In
Log Out
- : // Logged Out + : // Logged Out + + +

or

+ +
}
diff --git a/src/components/SideNav.js b/src/components/SideNav.js index 72feec3..33e4bb0 100644 --- a/src/components/SideNav.js +++ b/src/components/SideNav.js @@ -33,11 +33,13 @@ export default function SideNav() { icon={}> Settings + {/* } icon={}> Support + */} } icon={}> diff --git a/src/context/AppContext.js b/src/context/AppContext.js index b90fc7c..92c8cb6 100644 --- a/src/context/AppContext.js +++ b/src/context/AppContext.js @@ -48,8 +48,7 @@ export const AppProvider = (props) => { expenses: state.expenses, budget: state.budget, dispatch, - }} - > + }}> {props.children} ); diff --git a/src/pages/Login.css b/src/pages/Login.css new file mode 100644 index 0000000..12928ad --- /dev/null +++ b/src/pages/Login.css @@ -0,0 +1,41 @@ +.auth-wrapper { + display: flex; + justify-content: center; + flex-direction: column; + text-align: left; + } + .auth-inner { + width: 450px; + margin: auto; + background: #ffffff; + box-shadow: 0px 14px 60px rgba(34, 35, 58, 0.1); + padding: 40px 55px 45px 55px; + border-radius: 15px; + transition: all .3s; + } + .auth-wrapper .form-control:focus { + border-color: #167bff; + box-shadow: none; + } + .auth-wrapper h3 { + text-align: center; + margin: 0; + line-height: 1; + padding-bottom: 20px; + } + .custom-control-label { + font-weight: 400; + } + .forgot-password, + .forgot-password a { + font-size: 13px; + color: #7f7d7d; + margin: 0; + } + .forgot-password a { + color: #167bff; + } + + #remember-me { + margin-left: 10px; + } \ No newline at end of file diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx new file mode 100644 index 0000000..888e93f --- /dev/null +++ b/src/pages/Login.jsx @@ -0,0 +1,54 @@ +import React, { Component } from 'react' +import { Container } from 'react-bootstrap' +import './Login.css' + +export default function Login() { + return ( +
+
+
+

Sign In

+
+ + +
+
+ + +
+
+
+ + +
+
+
+ +
+

+ Don't have an account? sign up +

+

+ Forgot password? +

+
+
+
+ ) +} \ No newline at end of file diff --git a/src/pages/Signup.jsx b/src/pages/Signup.jsx new file mode 100644 index 0000000..835a828 --- /dev/null +++ b/src/pages/Signup.jsx @@ -0,0 +1,50 @@ +import './Login.css' +import React, { Component } from 'react' + +export default function SignUp() { + return ( +
+
+
+

Sign Up

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+

+ Already registered? log in +

+
+
+
+ ) +} \ No newline at end of file diff --git a/src/utils/utils.js b/src/utils/utils.js new file mode 100644 index 0000000..65c7f83 --- /dev/null +++ b/src/utils/utils.js @@ -0,0 +1,12 @@ +export default function checkLogin() { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = cookies[i].trim(); + if (cookie.indexOf('session=') === 0) { + // The "session" cookie exists + return true; + } + } + // The "session" cookie doesn't exist + return false; + } \ No newline at end of file