Skip to content

Commit

Permalink
feat: close mobile nav onclick
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 committed May 19, 2024
1 parent 5a8b132 commit 4b8d858
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app/components/Nav/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import "./Nav.scss";
const Nav = () => {
const { pathname } = useLocation();
const [mobileExpand, setMobileExpand] = useState(false);

const toggleMobileExpand = () => {
setMobileExpand(!mobileExpand);
};

if (pathname === "/designathon22/" || pathname === "/designathon22")
return <></>;

Expand Down Expand Up @@ -122,13 +124,19 @@ const Nav = () => {
{ label: "Contact", url: "/contact" },
{ label: "Houses", url: "/houses" },
].map(({ label, url }) => (
<Link key={url} to={url} className="item center">
<Link
key={url}
to={url}
className="item center"
onClick={toggleMobileExpand}
>
<Text size="L">{label}</Text>
</Link>
))}
<Link
to="/join"
className="item center button fill sky"
onClick={toggleMobileExpand}
>
<Text size="L">Join</Text>
</Link>
Expand Down

0 comments on commit 4b8d858

Please sign in to comment.