-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mortein 63 detail page navigation (#19)
- Loading branch information
Showing
14 changed files
with
188 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.navbar { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
background-color: #bacd92; | ||
padding: 1vh; | ||
font-family: "PilserBold", sans-serif; | ||
} | ||
|
||
.menu-icon, | ||
.search-icon, | ||
.back-icon { | ||
font-size: 4vh; | ||
margin: 0; | ||
} | ||
|
||
.navbar-title { | ||
font-size: 3vh; | ||
font-weight: bold; | ||
color: #7d9778; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,51 @@ | ||
import PropTypes from "prop-types"; | ||
import { useNavigate } from "react-router-dom"; // Import useNavigate for navigation | ||
import "../components/Navbar.css"; | ||
// Navigation header - used for both detail and plants pages | ||
// (with different props values) | ||
function Navbar(props) { | ||
const navigate = useNavigate(); // Initialize the navigation hook | ||
|
||
const handleSearchClick = () => { | ||
navigate("/search"); // Navigate to the search page when the icon is clicked | ||
}; | ||
|
||
const handleMenuClick = () => { | ||
navigate("/login"); // Navigate to the login page when the icon is clicked | ||
}; | ||
|
||
const handleBackClick = () => { | ||
navigate(-1); | ||
}; | ||
|
||
const clickLeftFunction = props.left == "Back" ? handleBackClick : handleMenuClick; | ||
const guideButton = ( | ||
<h2 className="menu-icon" onClick={handleSearchClick} style={{ cursor: "pointer" }}> | ||
🔍 | ||
</h2> | ||
); | ||
|
||
return ( | ||
<nav className="navbar"> | ||
<h2>{props.left}</h2> | ||
<h1>{props.title}</h1> | ||
<h2>Guide</h2> | ||
{props.left == "Back" ? ( | ||
<h2 className="back-icon" onClick={clickLeftFunction} style={{ cursor: "pointer" }}> | ||
< | ||
</h2> | ||
) : ( | ||
<h2 className="menu-icon" onClick={clickLeftFunction} style={{ cursor: "pointer" }}> | ||
☰ | ||
</h2> | ||
)} | ||
<h1 className="navbar-title">{props.title}</h1> | ||
{props.showGuide ? guideButton : <div></div>} | ||
</nav> | ||
); | ||
} | ||
|
||
Navbar.propTypes = { | ||
left: PropTypes.string, | ||
title: PropTypes.number, | ||
title: PropTypes.string, | ||
showGuide: PropTypes.bool, | ||
}; | ||
|
||
export default Navbar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.