From 5dcc5920c478362ed57420ee26eac1321dbf22a1 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Thu, 9 Mar 2023 20:53:20 -0800 Subject: [PATCH] fix navigation behavior and homepage layout --- src/components/GalleryImage/GalleryImage.js | 10 ++- src/components/KeywordsPicker.tsx | 22 +++---- src/components/MasonryGallery.tsx | 1 - src/components/Nav.tsx | 2 +- src/pages/photogallery.tsx | 67 +++++++++------------ 5 files changed, 43 insertions(+), 59 deletions(-) diff --git a/src/components/GalleryImage/GalleryImage.js b/src/components/GalleryImage/GalleryImage.js index a81794f..6af6433 100644 --- a/src/components/GalleryImage/GalleryImage.js +++ b/src/components/GalleryImage/GalleryImage.js @@ -63,6 +63,12 @@ const GalleryImage = ({ data, location: { state } }) => { setIsClient(true); }, []); + useEffect(() => { + requestAnimationFrame(() => { + window.scrollTo(0, 180); + }); + }, [image.base]); + const nextIndex = sortedImageList && currentIndex < sortedImageList.length ? currentIndex + 1 @@ -135,7 +141,7 @@ const GalleryImage = ({ data, location: { state } }) => { locationString = location.join(", "); } const vibrant = getVibrant(image, true); - const BLEND = 'hsl' + const BLEND = "hsl"; const darkAccent = chroma .mix(vibrant.Vibrant, "hsla(216, 0%, 90%, 1)", 0.6, BLEND) .hex(); @@ -145,7 +151,7 @@ const GalleryImage = ({ data, location: { state } }) => { ar > 1 ? "flex-col" : "portrait:mx-auto landscape:mx-5 landscape:flex-row-reverse portrait:flex-col"; - const verticalPad = ar > 1 ? "250px" : "100px"; + const verticalPad = ar > 1 ? "180px" : "20px"; const shutterSpeed = React.useMemo( () => diff --git a/src/components/KeywordsPicker.tsx b/src/components/KeywordsPicker.tsx index 0e6dc40..e0cd75f 100644 --- a/src/components/KeywordsPicker.tsx +++ b/src/components/KeywordsPicker.tsx @@ -1,19 +1,17 @@ import * as React from "react"; import classNames from "classnames"; -import Checkmark from "@spectrum-icons/workflow/Checkmark"; import { Link } from "gatsby"; interface KeywordsPickerProps { keywords: string[]; value: string | null; - onChange: (val: string | null) => void; + getHref: (value: string | null) => string; + onPick: (value: string | null) => void; } -const KeywordsPicker = ({ keywords, value, onChange }: KeywordsPickerProps) => { +const KeywordsPicker = ({ keywords, value, getHref, onPick }: KeywordsPickerProps) => { return (
- - Collections - + Collections
+ getGalleryPageUrl( + { keyword: val, sortKey, showDebug }, + hash + ) + } keywords={[ "Boyce Thompson Arboretum", "winter", @@ -283,7 +272,7 @@ const GalleryPage = ({ // "shoot the light", // "sunset", ]} - onChange={setKeyword} + onPick={onKeywordPick} value={filterKeyword} />
@@ -324,10 +313,8 @@ const GalleryPage = ({ "2xl": 6.1, "3xl": 8, }} - debugHue={sortKey === "hue_debug"} - // debugRating={sortKey === "rating" && showDebug} - // debugPublished={showDebug} dataFn={dataFn} + debugHue={sortKey === "hue_debug"} images={images} linkState={{ sortKey,