-
Notifications
You must be signed in to change notification settings - Fork 2
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
Tailwind Header #91
Open
eyeriss42
wants to merge
5
commits into
staging
Choose a base branch
from
header
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Tailwind Header #91
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,60 @@ | ||
import { useState } from "react"; | ||
import { Link } from "react-router-dom"; | ||
import IceCreamLogo from "./IceCreamLogo"; | ||
import CartPage from "../pages/cart/CartPage"; | ||
import styles from "./header.module.css"; | ||
|
||
import { NavLink } from "react-router-dom"; | ||
|
||
export default function IceCreamHeader() { | ||
const [currentPagePath, setCurrentPagePath] = useState<string>("/"); | ||
|
||
function handleSetStarPage(path: string) { | ||
setCurrentPagePath(path) | ||
} | ||
|
||
return ( | ||
<header className={styles["header-container"]}> | ||
<Link to="/" onClick={() => handleSetStarPage("/")}><IceCreamLogo />Randomice</Link> | ||
<header className="w-full flex justify-between items-center h-[100px] px-4 mt-4"> | ||
<Link to="/"> | ||
<div className="flex items-center justify-center mb-2"> | ||
<IceCreamLogo/> | ||
</div> | ||
<span className="mx-2">Randomice </span> | ||
</Link> | ||
|
||
<nav> | ||
<ul className={styles["nav-container"]}> | ||
<ul className="flex justify-center list-none ml-2"> | ||
<NavOption | ||
destinationUrl="/hall-of-fame" | ||
destinationPage="Hall of Fame" | ||
currentPagePath={currentPagePath} | ||
setCurrentPagePath={setCurrentPagePath} | ||
/> | ||
|
||
<NavOption | ||
destinationUrl="/random-flavors" | ||
destinationPage="Generate Random Flavors" | ||
currentPagePath={currentPagePath} | ||
setCurrentPagePath={setCurrentPagePath} | ||
/> | ||
</ul> | ||
</nav> | ||
<div className={styles["header-end"]}> | ||
<button className={styles["login-button"]}>login/logout</button> | ||
<div className="flex ml-auto"> | ||
<CartPage /> | ||
<button className="ml-2.5 mr-2.5 hover:underline">login/logout</button> | ||
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. Pls have only the relevant word visible - either Login or Logout, depending on whether the customer is logged in or not! |
||
</div> | ||
</header> | ||
); | ||
} | ||
|
||
interface NavOptionProps { | ||
className?: string; | ||
destinationUrl: string; | ||
destinationPage: string; | ||
currentPagePath: string; | ||
setCurrentPagePath(pageUrl: string): void; | ||
} | ||
|
||
function NavOption(props: NavOptionProps) { | ||
function NavOption({ className, destinationUrl, destinationPage}) { | ||
const linkBaseClasses = "text-center block py-2 px-4 rounded w-auto whitespace-nowrap"; | ||
const activeClasses = "border bg-purple-500 hover:bg-purple-700 text-white"; | ||
const inactiveClasses = "border border-white text-black-500 hover:border-black"; | ||
|
||
return ( | ||
<li className={styles["nav-item"]}> | ||
<Link to={props.destinationUrl} onClick={() => props.setCurrentPagePath(props.destinationUrl)}>{props.currentPagePath === props.destinationUrl ? "*" : ""} | ||
{props.destinationPage}</Link> | ||
<li className={`${className}`}> | ||
<NavLink | ||
to={destinationUrl} | ||
className={({ isActive }) => | ||
eyeriss42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`${linkBaseClasses} ${isActive ? activeClasses : inactiveClasses}` | ||
} | ||
> | ||
{destinationPage} | ||
</NavLink> | ||
</li> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It looks uneven to have the Randomice text on a different horizontal line than all of the rest of the text in the header. Shall we remove it?