Add internal nav to top nav on homepage

This commit is contained in:
Chuck Dries 2022-07-11 22:22:10 -07:00
parent fda58c87ed
commit 2c9aacc1a2
No known key found for this signature in database
GPG Key ID: A00B7AEAE1DC5BE6
3 changed files with 22 additions and 17 deletions

View File

@ -10,7 +10,11 @@ const getNavClasses = (isClient) =>
const Nav = ({ isClient, internalLinks, className }) => ( const Nav = ({ isClient, internalLinks, className }) => (
<nav <nav
className={classnames("m-2 flex justify-center", className)} className={classnames(
"m-2 flex justify-center",
isClient ? "text-vibrant-light" : "text-gray-200",
className
)}
style={{ zIndex: 100 }} style={{ zIndex: 100 }}
> >
<div <div
@ -25,7 +29,11 @@ const Nav = ({ isClient, internalLinks, className }) => (
{internalLinks && {internalLinks &&
internalLinks.map(({ href, label }) => ( internalLinks.map(({ href, label }) => (
<li key={href}> <li key={href}>
<Link className={getNavClasses(isClient)} to={href}> <Link
activeClassName="font-bold underline"
className={getNavClasses(isClient)}
to={href}
>
{label} {label}
</Link> </Link>
</li> </li>

View File

@ -2,12 +2,11 @@ import React from "react";
import classnames from "classnames"; import classnames from "classnames";
import { Link } from "gatsby"; import { Link } from "gatsby";
import Image from "@spectrum-icons/workflow/Image";
import Shuffle from "@spectrum-icons/workflow/Shuffle"; import Shuffle from "@spectrum-icons/workflow/Shuffle";
const getButtonClasses = (isClient) => const getButtonClasses = (isClient) =>
classnames( classnames(
"z-20 rounded-md text-md inline-block px-2 py-1 mt-1 md:py-2 md:px-3 md:my-1 mr-2 text-md hover:underline text-black", "z-20 rounded-md text-md inline-block px-2 py-1 mt-1 mr-2 text-md hover:underline text-black",
isClient ? "cool-border-small hover:bg-vibrant" : "text-gray-200" isClient ? "cool-border-small hover:bg-vibrant" : "text-gray-200"
); );
@ -26,10 +25,9 @@ const ActionButtons = ({ isClient, image, shuffleImage }) => (
<Link <Link
className={getButtonClasses(isClient, "muted")} className={getButtonClasses(isClient, "muted")}
id="image-link" id="image-link"
title="view image details"
to={`/photogallery/${image.base}/`} to={`/photogallery/${image.base}/`}
> >
<Image aria-label="view image details" /> view image
</Link> </Link>
<button <button
className={getButtonClasses(isClient, "muted")} className={getButtonClasses(isClient, "muted")}
@ -37,18 +35,11 @@ const ActionButtons = ({ isClient, image, shuffleImage }) => (
onClick={() => { onClick={() => {
shuffleImage(image); shuffleImage(image);
}} }}
title="shuffle image"
type="button" type="button"
> >
<Shuffle aria-label="shuffle image" size="S" /> shuffle background
<Shuffle UNSAFE_className="ml-1" aria-label="shuffle image" size="XS" />
</button> </button>
<Link
className={getButtonClasses(isClient, "muted")}
id="photogallery-link"
to="/photogallery/"
>
Photography Gallery
</Link>
</div> </div>
</div> </div>
); );

View File

@ -5,7 +5,7 @@ import { Helmet } from "react-helmet";
import { take } from "ramda"; import { take } from "ramda";
import classnames from "classnames"; import classnames from "classnames";
import '../styles/index.css'; import "../styles/index.css";
import { getHelmetSafeBodyStyle, getVibrant, getAspectRatio } from "../utils"; import { getHelmetSafeBodyStyle, getVibrant, getAspectRatio } from "../utils";
import Nav from "../components/Nav"; import Nav from "../components/Nav";
@ -134,7 +134,13 @@ const IndexPage = ({
)} )}
style={{ gridArea: "1/1" }} style={{ gridArea: "1/1" }}
> >
<Nav isClient={isClient} /> <Nav
internalLinks={[
{ href: "/", label: "Home" },
{ href: "/photogallery/", label: "Gallery" },
]}
isClient={isClient}
/>
<div <div
className={classnames( className={classnames(
"rounded-[50px] p-3 md:p-5 flex flex-col items-center z-10 border-r-[20px] border-b-[20px] mb-3 mx-2 md:mb-[-90px]", "rounded-[50px] p-3 md:p-5 flex flex-col items-center z-10 border-r-[20px] border-b-[20px] mb-3 mx-2 md:mb-[-90px]",