-
Notifications
You must be signed in to change notification settings - Fork 1
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
Granthamblin0/tces 9 urd navbar #23
Changes from 5 commits
11dc5f9
8cf2f20
f6a13e0
e1d84d7
efe3309
d4b55b8
b264930
5689395
0bbcb8f
d05dc71
8ba3485
bf22707
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ node_modules | |
README.md | ||
.eslintrc.json | ||
package-lock.json | ||
package.json | ||
package.json | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,4 @@ function App() { | |
</div> | ||
); | ||
} | ||
|
||
export default App; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.dropdown-container { | ||
margin-top: 10px; | ||
border-radius: 8px; | ||
background: var(--light-background-paper, #fff); | ||
box-shadow: | ||
0px 1px 5px 0px rgba(0, 0, 0, 0.12), | ||
0px 2px 2px 0px rgba(0, 0, 0, 0.14), | ||
0px 3px 1px -2px rgba(0, 0, 0, 0.2); | ||
width: 600px; | ||
position: fixed; | ||
top: 56px; | ||
left: 812px; | ||
} | ||
|
||
.dropdown-title { | ||
color: var(--light-text-primary, rgba(0, 0, 0, 0.87)); | ||
font-feature-settings: | ||
"clig" off, | ||
"liga" off; | ||
font-size: 24px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 133.4%; /* 32.016px */ | ||
height: 32px; | ||
padding: 16px; | ||
display: flex; | ||
align-items: center; | ||
align-self: stretch; | ||
border-bottom: 1px solid #0000008a; | ||
} | ||
|
||
.dropdown-item-container { | ||
display: flex; | ||
padding: 8px 16px; | ||
align-items: center; | ||
align-self: stretch; | ||
justify-content: space-between; | ||
height: 48px; | ||
background: none; | ||
border: none; | ||
} | ||
|
||
.dropdown-item-container:not(:last-child) { | ||
border-bottom: 1px solid #0000008a; | ||
} | ||
|
||
.dropdown-items { | ||
display: flex; | ||
padding: 16px; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
align-self: stretch; | ||
} | ||
|
||
.dropdown-item-text { | ||
color: var(--light-text-primary, rgba(0, 0, 0, 0.87)); | ||
font-feature-settings: | ||
"clig" off, | ||
"liga" off; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 150%; | ||
letter-spacing: 0.15px; | ||
} | ||
|
||
.dropdown-item-left-content { | ||
display: flex; | ||
gap: 22px; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import PropTypes from "prop-types"; | ||
import "./Dropdown.css"; | ||
import DropdownItem from "./DropdownItem"; | ||
|
||
function Dropdown({ isAdmin }) { | ||
return ( | ||
<div className="dropdown-container"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. set z-index to some high number so that despite any other components being rendered on the page, the dropdown can be seen. |
||
<div className="dropdown-title">Profile</div> | ||
<div className="dropdown-items"> | ||
jordanjanakievski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{isAdmin && <DropdownItem label="Admin Dashboard" keyword="admin" />} | ||
<DropdownItem label="Settings" keyword="settings" /> | ||
<DropdownItem label="Log Out" keyword="logout" /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
Dropdown.propTypes = { | ||
isAdmin: PropTypes.bool.isRequired, | ||
}; | ||
|
||
export default Dropdown; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import PropTypes from "prop-types"; | ||
import "./Navbar.css"; | ||
import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; | ||
import SettingsIcon from "@mui/icons-material/Settings"; | ||
import LogoutIcon from "@mui/icons-material/Logout"; | ||
import AdminIcon from "@mui/icons-material/Group"; | ||
|
||
function DropdownItem({ label, keyword }) { | ||
const icons = { | ||
settings: <SettingsIcon color="action" />, | ||
logout: <LogoutIcon color="action" />, | ||
admin: <AdminIcon color="action" />, | ||
}; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would also recommend retrieving label from a dictionary that matches keyword to label as you have done with icons. |
||
const icon = icons[keyword]; | ||
|
||
return ( | ||
<div className="dropdown-item-container"> | ||
<div className="dropdown-item-left-content"> | ||
{icon} | ||
<div className="dropdown-item-text">{label}</div> | ||
</div> | ||
<ArrowForwardIcon color="action" /> | ||
</div> | ||
); | ||
} | ||
|
||
DropdownItem.propTypes = { | ||
label: PropTypes.string.isRequired, | ||
keyword: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default DropdownItem; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.nav-container { | ||
display: flex; | ||
justify-content: space-between; | ||
flex: 1; | ||
padding: 8px 16px; | ||
border-bottom: 1px solid #0000008a; | ||
background: var(--light-primary-contrast, #fff); | ||
box-shadow: | ||
0px 1px 5px 0px rgba(0, 0, 0, 0.12), | ||
0px 2px 2px 0px rgba(0, 0, 0, 0.14), | ||
0px 3px 1px -2px rgba(0, 0, 0, 0.2); | ||
} | ||
|
||
.left-content { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
|
||
.right-content { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.right-content-image { | ||
padding: 12px; | ||
background: none; | ||
border: none; | ||
} | ||
.left-content-buttons { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 342px; | ||
margin-left: 50px; | ||
} | ||
|
||
.nav-left-button { | ||
color: rgba(0, 0, 0, 0.6); | ||
background: none; | ||
border: none; | ||
font-size: 15px; | ||
font-weight: 500; | ||
line-height: 26px; | ||
letter-spacing: 0.46000000834465027px; | ||
text-align: left; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState } from "react"; | ||
import logo from "../../../public/img/tces-logo.png"; | ||
import Dropdown from "./Dropdown"; | ||
import NavbarProfile from "./NavbarProfile"; | ||
import NavbarButton from "./NavbarButton"; | ||
|
||
function Navbar() { | ||
const [isDropdownVisible, setIsDropdownVisible] = useState(false); | ||
|
||
const toggleDropdown = () => { | ||
setIsDropdownVisible(!isDropdownVisible); | ||
}; | ||
|
||
return ( | ||
<div className="nav-container"> | ||
<div className="left-content"> | ||
<div className="image"> | ||
<img src={logo} alt="logo" width="46" height="50" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace {logo} with "./img/tcesLogo.svg". svgs scale much better and are generally favourable over their png counterparts. Also please delete the tces-logo.png file from public/img |
||
</div> | ||
<div className="left-content-buttons"> | ||
<NavbarButton title="CLIENTS" /> | ||
<NavbarButton title="JOB LEADS" /> | ||
<NavbarButton title="EMPLOYERS" /> | ||
</div> | ||
</div> | ||
<div className="right-content"> | ||
<NavbarProfile toggleDropdown={toggleDropdown} /> | ||
</div> | ||
{isDropdownVisible && <Dropdown isAdmin />} | ||
</div> | ||
); | ||
} | ||
|
||
export default Navbar; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import PropTypes from "prop-types"; | ||
import "./Navbar.css"; | ||
|
||
function NavbarButton({ title }) { | ||
return ( | ||
<button type="button" className="nav-left-button"> | ||
{title} | ||
</button> | ||
); | ||
} | ||
|
||
NavbarButton.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default NavbarButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import PropTypes from "prop-types"; | ||
import "./Navbar.css"; | ||
import IconButton from "@mui/material/IconButton"; | ||
import AccountCircleIcon from "@mui/icons-material/AccountCircle"; | ||
|
||
function NavbarProfile({ toggleDropdown }) { | ||
return ( | ||
<IconButton className="right-content-image" onClick={toggleDropdown}> | ||
<AccountCircleIcon /> | ||
</IconButton> | ||
); | ||
} | ||
|
||
NavbarProfile.propTypes = { | ||
toggleDropdown: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default NavbarProfile; |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever a user clicks off of the dropdown it should close it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'm struggling with implementing this