sticky header in photo gallery
This commit is contained in:
parent
ad21989140
commit
f6e9b4393a
@ -28,7 +28,9 @@ const MasonryGallery = ({
|
|||||||
if (!el) {
|
if (!el) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
el.scrollIntoView();
|
el.scrollIntoView({
|
||||||
|
block: "center",
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
@ -19,8 +19,8 @@ const GalleryPage = ({ data }) => {
|
|||||||
(key) => {
|
(key) => {
|
||||||
try {
|
try {
|
||||||
window.plausible("Sort Gallery", {
|
window.plausible("Sort Gallery", {
|
||||||
props: { key }
|
props: { key },
|
||||||
})
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
@ -33,9 +33,9 @@ const GalleryPage = ({ data }) => {
|
|||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const _sortKey = localStorage.getItem("photogallery.sortkey");
|
const _sortKey = localStorage.getItem("photogallery.sortkey");
|
||||||
if (_sortKey) {
|
if (_sortKey) {
|
||||||
setSortKey(_sortKey)
|
setSortKey(_sortKey);
|
||||||
}
|
}
|
||||||
}, [setSortKey])
|
}, [setSortKey]);
|
||||||
|
|
||||||
const images = React.useMemo(
|
const images = React.useMemo(
|
||||||
() =>
|
() =>
|
||||||
@ -66,6 +66,7 @@ const GalleryPage = ({ data }) => {
|
|||||||
<title>Photo Gallery | Chuck Dries</title>
|
<title>Photo Gallery | Chuck Dries</title>
|
||||||
<body className="bg-black text-white" />
|
<body className="bg-black text-white" />
|
||||||
</Helmet>
|
</Helmet>
|
||||||
|
<div className="sticky top-0 z-10 bg-black">
|
||||||
<nav className="mt-1 ml-1 text-lg mb-4">
|
<nav className="mt-1 ml-1 text-lg mb-4">
|
||||||
<button
|
<button
|
||||||
className="hover:underline text-vibrant-light hover:text-muted-light arrow-left-before mr-1"
|
className="hover:underline text-vibrant-light hover:text-muted-light arrow-left-before mr-1"
|
||||||
@ -87,9 +88,8 @@ const GalleryPage = ({ data }) => {
|
|||||||
gallery
|
gallery
|
||||||
</Link>
|
</Link>
|
||||||
</nav>
|
</nav>
|
||||||
<div className="bg-black min-h-screen mx-auto">
|
<div className="flex flex-row items-end">
|
||||||
<div className="flex flex-col sm:flex-row items-stretch sm:items-end">
|
<h1 className="text-3xl sm:text-5xl mt-0 ml-5 font-serif font-black z-10 flex-auto">
|
||||||
<h1 className="text-5xl mt-0 ml-5 font-serif font-black z-10 flex-auto">
|
|
||||||
Photo Gallery
|
Photo Gallery
|
||||||
</h1>
|
</h1>
|
||||||
<div className="m-2 ml-5 self-end">
|
<div className="m-2 ml-5 self-end">
|
||||||
@ -104,7 +104,7 @@ const GalleryPage = ({ data }) => {
|
|||||||
</Picker>
|
</Picker>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mx-auto">
|
</div>
|
||||||
<MasonryGallery
|
<MasonryGallery
|
||||||
aspectsByBreakpoint={{
|
aspectsByBreakpoint={{
|
||||||
sm: 3,
|
sm: 3,
|
||||||
@ -116,17 +116,13 @@ const GalleryPage = ({ data }) => {
|
|||||||
debug={sortKey === "hue_debug"}
|
debug={sortKey === "hue_debug"}
|
||||||
images={images}
|
images={images}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const query = graphql`
|
export const query = graphql`
|
||||||
query GalleryPageQuery {
|
query GalleryPageQuery {
|
||||||
allFile(
|
allFile(filter: { sourceInstanceName: { eq: "gallery" } }) {
|
||||||
filter: { sourceInstanceName: { eq: "gallery" } }
|
|
||||||
) {
|
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
relativePath
|
relativePath
|
||||||
|
Loading…
x
Reference in New Issue
Block a user