Skip to content

Commit

Permalink
Add logout feature
Browse files Browse the repository at this point in the history
  • Loading branch information
hmunish committed Nov 3, 2023
1 parent 0a8fc17 commit 417aba5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 14 deletions.
12 changes: 12 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ main {
width: 100%;
}

div.signout {
display: flex;
align-items: center;
cursor: pointer;
}

div.footer-wrapper {
display: flex;
flex-direction: column;
gap: 11px;
}

/* Add reservation page starts here */

section.add-reservation,
Expand Down
6 changes: 1 addition & 5 deletions src/CSS/NavMenu.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
background-color: #fff;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}

Expand All @@ -13,7 +14,6 @@

.navigation {
width: 75%;
margin-top: 10rem;
}

.navlist {
Expand All @@ -38,7 +38,3 @@ a {
background-color: #97bf0f;
color: #fff;
}

.icons {
margin-top: 10rem;
}
46 changes: 37 additions & 9 deletions src/components/nav/NavMenu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { NavLink } from "react-router-dom";
// eslint-disable-next-line import/no-extraneous-dependencies
import { UilTwitter, UilFacebookF } from '@iconscout/react-unicons';
import { UilTwitter, UilFacebookF, UilSignout } from "@iconscout/react-unicons";
import styles from "../../CSS/NavMenu.module.css";
import v from "../../assets/v.png";
import google from "../../assets/google.png";
Expand All @@ -16,6 +16,11 @@ const NavMenu = () => {
setIsOpen(!isOpen);
};

const signout = () => {
localStorage.removeItem("authKey");
window.location.pathname = "/";
};

return (
<section className="sidebar">
<button className="mobmenu" type="button" onClick={toggleMenu}>
Expand Down Expand Up @@ -69,15 +74,38 @@ const NavMenu = () => {
</li>
</ul>
</nav>
<div className={styles.icons}>
<UilTwitter />
<UilFacebookF />
<img style={{ width: '20px', height: '20px' }} src={v} alt="v icon" />
<img style={{ width: '30px', height: '20px', marginLeft: '5px' }} src={google} alt="google icon" />
<img style={{ width: '30px', height: '20px', marginLeft: '5px' }} src={pinterest} alt="pinterest icon" />
<div className="footer-wrapper">
<div
className="signout"
onClick={() => signout()}
role="link"
tabIndex={-1}
aria-hidden="true"
>
<UilSignout />
<p>Sign Out</p>
</div>
<div className={styles.icons}>
<UilTwitter />
<UilFacebookF />
<img
style={{ width: "20px", height: "20px" }}
src={v}
alt="v icon"
/>
<img
style={{ width: "30px", height: "20px", marginLeft: "5px" }}
src={google}
alt="google icon"
/>
<img
style={{ width: "30px", height: "20px", marginLeft: "5px" }}
src={pinterest}
alt="pinterest icon"
/>
</div>
<p>2023 All right reserved</p>
</div>
<p />
2023 All right reserved
</div>
<div />
</>
Expand Down

0 comments on commit 417aba5

Please sign in to comment.