clean up index query
This commit is contained in:
parent
3bc06cc0c8
commit
cbc77893c5
@ -26,12 +26,11 @@ const getDifferentRand = (range, lastNs, iterations = 0) => {
|
|||||||
|
|
||||||
const IndexPage = ({
|
const IndexPage = ({
|
||||||
data: {
|
data: {
|
||||||
allFile: { edges },
|
allFile: { nodes: images },
|
||||||
},
|
},
|
||||||
}) => {
|
}) => {
|
||||||
const [isClient, setIsClient] = React.useState(false);
|
const [isClient, setIsClient] = React.useState(false);
|
||||||
const [imageIndex, setImageIndex] = React.useState(0);
|
const [imageIndex, setImageIndex] = React.useState(0);
|
||||||
const images = React.useMemo(() => edges.map((edge) => edge.node), [edges]);
|
|
||||||
const image = React.useMemo(() => {
|
const image = React.useMemo(() => {
|
||||||
return images[imageIndex];
|
return images[imageIndex];
|
||||||
}, [images, imageIndex]);
|
}, [images, imageIndex]);
|
||||||
@ -255,25 +254,23 @@ export const query = graphql`
|
|||||||
}
|
}
|
||||||
sort: { order: DESC, fields: fields___imageMeta___dateTaken }
|
sort: { order: DESC, fields: fields___imageMeta___dateTaken }
|
||||||
) {
|
) {
|
||||||
edges {
|
nodes {
|
||||||
node {
|
relativePath
|
||||||
relativePath
|
base
|
||||||
base
|
childImageSharp {
|
||||||
childImageSharp {
|
fluid {
|
||||||
fluid {
|
aspectRatio
|
||||||
aspectRatio
|
|
||||||
}
|
|
||||||
gatsbyImageData(
|
|
||||||
layout: FULL_WIDTH
|
|
||||||
placeholder: NONE
|
|
||||||
breakpoints: [750, 1080, 1366, 1920, 2560, 3840]
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
fields {
|
gatsbyImageData(
|
||||||
imageMeta {
|
layout: FULL_WIDTH
|
||||||
vibrant {
|
placeholder: NONE
|
||||||
...VibrantColors
|
breakpoints: [750, 1080, 1366, 1920, 2560, 3840]
|
||||||
}
|
)
|
||||||
|
}
|
||||||
|
fields {
|
||||||
|
imageMeta {
|
||||||
|
vibrant {
|
||||||
|
...VibrantColors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user