Skip to content

Commit 2298417

Browse files
authored
Merge pull request #1124 from ossd-s23/igoyal1
Added Dropdown Under Profile Icon
2 parents e6245f4 + 248fe33 commit 2298417

File tree

1 file changed

+68
-18
lines changed

1 file changed

+68
-18
lines changed
Lines changed: 68 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useState } from "react"
2-
import { Container, Navbar } from "react-bootstrap"
2+
import { Container, Navbar, Nav} from "react-bootstrap"
33
import Image from "react-bootstrap/Image"
4-
import { Role, useAuth } from "../auth"
4+
import { Role, signOutAndRedirectToHome, useAuth } from "../auth"
55
import { NavLink } from "../Navlink"
66
import styles from "./ProfileLink.module.css"
77

@@ -25,6 +25,11 @@ const ProfileLink = ({
2525
}) => {
2626
const { user } = useAuth()
2727
const [search, setSearch] = useState("")
28+
const [sticky, setSticky] = useState(false)
29+
const [isExpanded, setIsExpanded] = useState(false)
30+
31+
const toggleNav = () => setIsExpanded(!isExpanded)
32+
const closeNav = () => setIsExpanded(false)
2833

2934
useEffect(() => {
3035
if (user?.uid) {
@@ -33,22 +38,67 @@ const ProfileLink = ({
3338
}, [user?.uid])
3439

3540
return (
36-
<Container className={`py-0`}>
37-
<NavLink href={"/profile" + search} className="py-0">
38-
<div style={{ display: "flex", alignItems: "center", padding: 0 }}>
39-
<Image
40-
className={styles.profileLinkImage}
41-
src="/profile-icon.svg"
42-
alt="profile icon"
43-
/>
44-
<Navbar expand="lg" className="p-0">
45-
<Navbar.Collapse id="topnav">
46-
<Navbar.Brand>{greeting(role, displayName)}</Navbar.Brand>
47-
</Navbar.Collapse>
48-
</Navbar>
49-
</div>
50-
</NavLink>
51-
</Container>
41+
<>
42+
<Navbar
43+
bg="secondary"
44+
variant="dark"
45+
sticky={sticky ? "top" : undefined}
46+
expand={false}
47+
expanded={isExpanded}
48+
className="p-0">
49+
<Container className={`py-0`}>
50+
<div className={styles.navbar_boxes_container}>
51+
<Navbar.Brand className="mx-2 p-0" onClick={toggleNav}>
52+
<Nav.Link className="p-0">
53+
<Image
54+
className={styles.profileLinkImage}
55+
src="/profile-icon.svg"
56+
alt="profile icon">
57+
</Image>
58+
{greeting(role, displayName)}
59+
</Nav.Link>
60+
</Navbar.Brand>
61+
</div>
62+
<Navbar.Collapse id="topnav">
63+
<Nav className="me-auto">
64+
<NavLink
65+
className={"navLink-primary"}
66+
href={"/profile" + search}
67+
handleClick={closeNav}>
68+
View Profile
69+
</NavLink>
70+
<NavLink
71+
className={"navLink-primary"}
72+
href="/editprofile"
73+
handleClick={closeNav}>
74+
Edit Profile
75+
</NavLink>
76+
<NavLink
77+
className={"navLink-primary"}
78+
handleClick={() => {
79+
closeNav()
80+
void signOutAndRedirectToHome()}}>
81+
Sign Out
82+
</NavLink>
83+
</Nav>
84+
</Navbar.Collapse>
85+
{/* <NavLink href={"/profile" + search} className="py-0">
86+
<div style={{ display: "flex", alignItems: "center", padding: 0 }}>
87+
<Image
88+
className={styles.profileLinkImage}
89+
src="/profile-icon.svg"
90+
alt="profile icon"
91+
/>
92+
<Navbar expand="lg" className="p-0">
93+
<Navbar.Collapse id="topnav">
94+
<Navbar.Brand>{greeting(role, displayName)}</Navbar.Brand>
95+
</Navbar.Collapse>
96+
</Navbar>
97+
</div>
98+
</NavLink> */}
99+
</Container>
100+
</Navbar>
101+
</>
52102
)
53103
}
54104
export default ProfileLink

0 commit comments

Comments
 (0)