From 4a9a13fc16c34cc5d56244f0240499eb37fe546e Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Mon, 11 Jul 2022 22:29:30 -0700 Subject: [PATCH] fix layout portrait image on landscape browser without nav arrows --- src/components/GalleryImage/GalleryImage.js | 64 ++++++++++++++------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/src/components/GalleryImage/GalleryImage.js b/src/components/GalleryImage/GalleryImage.js index 1181ad8..818fd58 100644 --- a/src/components/GalleryImage/GalleryImage.js +++ b/src/components/GalleryImage/GalleryImage.js @@ -4,8 +4,8 @@ import { GatsbyImage, getImage } from "gatsby-plugin-image"; import { Helmet } from "react-helmet"; import classnames from "classnames"; -import ChevronLeft from '@spectrum-icons/workflow/ChevronLeft'; -import ChevronRight from '@spectrum-icons/workflow/ChevronRight'; +import ChevronLeft from "@spectrum-icons/workflow/ChevronLeft"; +import ChevronRight from "@spectrum-icons/workflow/ChevronRight"; import Calendar from "@spectrum-icons/workflow/Calendar"; import Stopwatch from "@spectrum-icons/workflow/Stopwatch"; import Exposure from "@spectrum-icons/workflow/Exposure"; @@ -43,12 +43,7 @@ const ArrowLinkClasses = `hover:underline text-vibrant-light hover:text-muted-li lg:px-4 self-stretch flex items-center hover:bg-black/50 max-h-screen sticky top-0 `; -const GalleryImage = ({ - data, - location: { - state - }, -}) => { +const GalleryImage = ({ data, location: { state } }) => { const { sortedImageList, currentIndex, filterKeyword, sortKey } = state ?? {}; const image = data.file; const ar = getAspectRatio(image); @@ -56,7 +51,9 @@ const GalleryImage = ({ const [zoom, setZoom] = useState(false); const [isClient, setIsClient] = useState(true); - useEffect(() => {setIsClient(true)}, []) + useEffect(() => { + setIsClient(true); + }, []); const nextIndex = sortedImageList && currentIndex < sortedImageList.length @@ -153,15 +150,26 @@ const GalleryImage = ({ />
-