Merge branch 'gallery-nav-arrows' into main

This commit is contained in:
Chuck Dries 2022-07-11 17:30:05 -07:00
commit 15cea93e53
2 changed files with 131 additions and 124 deletions

View File

@ -4,6 +4,8 @@ import { GatsbyImage, getImage } from "gatsby-plugin-image";
import { Helmet } from "react-helmet"; import { Helmet } from "react-helmet";
import classnames from "classnames"; import classnames from "classnames";
import ChevronLeft from '@spectrum-icons/workflow/ChevronLeft';
import ChevronRight from '@spectrum-icons/workflow/ChevronRight';
import Calendar from "@spectrum-icons/workflow/Calendar"; import Calendar from "@spectrum-icons/workflow/Calendar";
import Stopwatch from "@spectrum-icons/workflow/Stopwatch"; import Stopwatch from "@spectrum-icons/workflow/Stopwatch";
import Exposure from "@spectrum-icons/workflow/Exposure"; import Exposure from "@spectrum-icons/workflow/Exposure";
@ -36,6 +38,10 @@ const logKeyShortcut = (keyCode) => {
} }
}; };
const ArrowLinkClasses = `hover:underline text-vibrant-light hover:text-muted-light
lg:px-4 self-stretch flex items-center hover:bg-black/50 max-h-screen sticky top-0
`;
const GalleryImage = ({ const GalleryImage = ({
data, data,
location: { location: {
@ -166,9 +172,11 @@ const GalleryImage = ({
> >
gallery <span className="bg-gray-300 text-black">esc</span> gallery <span className="bg-gray-300 text-black">esc</span>
</Link> </Link>
</nav>
<div className="flex justify-between flex-auto items-center lg:gap-2">
{prevImage && ( {prevImage && (
<Link <Link
className="hover:underline text-vibrant-light hover:text-muted-light mx-1" className={ArrowLinkClasses}
state={{ state={{
currentIndex: currentIndex - 1, currentIndex: currentIndex - 1,
sortedImageList, sortedImageList,
@ -177,29 +185,14 @@ const GalleryImage = ({
}} }}
to={`/photogallery/${prevImage}/`} to={`/photogallery/${prevImage}/`}
> >
previous <span className="bg-gray-300 text-black">&#11104;</span> <span className="p-1 lg:p-4 bg-muted-light/25 rounded-full"><ChevronLeft /></span>
</Link> </Link>
)} )}
{nextImage && ( <div className={classnames("pb-2 flex", orientationClasses)}>
<Link
className="hover:underline text-vibrant-light hover:text-muted-light mx-1"
state={{
currentIndex: currentIndex + 1,
sortedImageList,
filterKeyword,
sortKey,
}}
to={`/photogallery/${nextImage}/`}
>
next <span className="bg-gray-300 text-black">&#11106;</span>
</Link>
)}
</nav>
<div className={classnames("flex", orientationClasses)}>
<div <div
className={classnames( className={classnames(
zoom ? "cursor-zoom-out" : "cursor-zoom-in", zoom ? "cursor-zoom-out" : "cursor-zoom-in",
"mb-2" "mb-2 self-center"
)} )}
onClick={() => setZoom((_zoom) => !_zoom)} onClick={() => setZoom((_zoom) => !_zoom)}
style={{ style={{
@ -271,7 +264,7 @@ const GalleryImage = ({
icon={<Calendar />} icon={<Calendar />}
title="date taken" title="date taken"
/> />
<div className="flex justify-end gap-2 border border-vibrant-light pl-2 rounded"> <div className="sm:flex justify-end gap-2 border border-vibrant-light pl-2 rounded">
<MetadataItem <MetadataItem
data={shutterSpeed} data={shutterSpeed}
icon={<Stopwatch />} icon={<Stopwatch />}
@ -313,7 +306,21 @@ const GalleryImage = ({
</div> </div>
</div> </div>
</div> </div>
<div></div> {nextImage && (
<Link
className={ArrowLinkClasses}
state={{
currentIndex: currentIndex + 1,
sortedImageList,
filterKeyword,
sortKey,
}}
to={`/photogallery/${nextImage}/`}
>
<span className="p-1 lg:p-4 bg-muted-light/25 rounded-full"><ChevronRight /></span>
</Link>
)}
</div>
</div> </div>
</> </>
); );

View File

@ -5,7 +5,7 @@ const MetadataItem = ({ icon, data, title }) =>
<div className="flex justify-end items-end mr-2 font-mono"> <div className="flex justify-end items-end mr-2 font-mono">
<div className="flex flex-col items-end my-2"> <div className="flex flex-col items-end my-2">
<span className="text-sm opacity-60 m-0 ">{title}</span> <span className="text-sm opacity-60 m-0 ">{title}</span>
<span className="text-lg leading-4">{data}</span> <span className="md:text-lg leading-4">{data}</span>
</div> </div>
<span className="ml-2 pb-2 text-2xl"> <span className="ml-2 pb-2 text-2xl">
{icon} {icon}