fix gallery image autoscroll, hide hashes on recently published section (and plumb linkstate)

This commit is contained in:
Chuck Dries 2023-03-11 00:53:16 -08:00
parent c574a31ba2
commit 5df63bf44a
4 changed files with 8 additions and 5 deletions

View File

@ -37,7 +37,6 @@ export const shouldUpdateScroll = ({
// window.scrollTo(0, 180);
// })
// }
console.log('gallery image, skipping')
return false;
}
if (prevRouterProps?.location.pathname === pathname) {

View File

@ -64,12 +64,12 @@ const GalleryImage = ({ data, location: { state } }) => {
}, []);
useEffect(() => {
requestAnimationFrame(() => {
setTimeout(() => {
window.scrollTo({
top: 180,
behavior: 'smooth'
});
});
}, 50);
}, [image.base]);
const nextIndex =

View File

@ -138,8 +138,8 @@ const MasonryGallery = ({
const data = dataFn ? dataFn(image) : null;
return (
<Link
className={classNames("border-8 border-white overflow-hidden relative")}
id={image.base}
className="border-8 border-white overflow-hidden relative"
id={singleRow ? undefined : image.base}
key={`${image.base}`}
state={{
...linkState,

View File

@ -264,6 +264,10 @@ const GalleryPage = ({
"3xl": 8,
}}
images={recents}
linkState={{
sortKey: 'datePublished',
filterKeyword,
}}
singleRow
/>
</div>