Skip to content

Commit

Permalink
now header is able to be different visually based on pathname
Browse files Browse the repository at this point in the history
  • Loading branch information
Cesar Faber authored and Cesar Faber committed Jan 31, 2024
1 parent bbee1cc commit 27e16d9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import Container from "../Container";
import "./index.scss";
import Shortcut from "../Shortcut";


const Header = ({ hideShortcut }) => {
const pathname = window?.location?.pathname;
return (
<header className="header">
<Container>
Expand All @@ -18,11 +20,21 @@ const Header = ({ hideShortcut }) => {
{!hideShortcut && <Shortcut text="👀" />}
<ul className="header-list">
<li>
<Link to="/about">about</Link>
<Link
to="/about/"
className={pathname?.startsWith("/about") ? `-active` : ``}
>
about
</Link>
</li>

<li>
<Link to="/recruiter">for recruiters</Link>
<Link
to="/recruiter/"
className={pathname?.startsWith("/recruiter") ? `-active` : ``}
>
for recruiters
</Link>
</li>
</ul>
</Container>
Expand Down
7 changes: 7 additions & 0 deletions src/components/Header/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
&:last-of-type {
margin-right: 0;
}

a {
&.-active {
color: white;
text-decoration: underline;
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/pages/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ const About = () => {

export default About;

export const Head = () => <title>sobre</title>;
export const Head = () => <title>sobre | cesarolvr</title>;
2 changes: 1 addition & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ const IndexPage = () => {

export default IndexPage;

export const Head = () => <title>cesarolvr.com</title>;
export const Head = () => <title>cesarolvr</title>;

0 comments on commit 27e16d9

Please sign in to comment.