Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Photo Galleries #39

Closed
eugelogic opened this issue Feb 12, 2019 · 2 comments
Closed

Add Photo Galleries #39

eugelogic opened this issue Feb 12, 2019 · 2 comments

Comments

@eugelogic
Copy link
Owner

https://github.com/neptunian/react-photo-gallery

@eugelogic
Copy link
Owner Author

Consider building a photo gallery component and pass images in with gatsby-image

@eugelogic
Copy link
Owner Author

eugelogic commented Feb 27, 2019

Right, I've done that with the help of the following resources:

Firstly, for some very odd reason, an image of name HLCCHL-Hall-Hire-5.jpg would break the page. Any other images with different numbers at the end would work just fine ie HLCCHL-Hall-Hire-1.jpg or HLCCHL-Hall-Hire-6.jpg.
Then, once I made it work, I changed the file names of the images to make them more self descriptive like Holly-Lodge-Community-Centre-Hall-Hire-1.jpg. For some reason, renaming broke the page. For some even more bizarre reason, resetting the code to the way it was before when it worked it didn't help, I would still get a TypeError: Cannot read property 'node' of undefined error over the return <Img fluid={file.node.childImageSharp.fluid} /> line of code in the gallery-img.js component.

Eventually, because I believe in miracles, I committed the code anyway to a branch in the hope that it would work on live 🤞but as I feared I got an WebpackError: TypeError: Cannot read property 'node' of undefined error. See details of the deploy on Netlify https://app.netlify.com/sites/hlcchl-gatsby/deploys/5c77095129b6e10008faf33c and see branch https://github.com/eugelogic/hlcchl-gatsby/tree/gallery-img-comp and/or commit 78914f1

Last and least, I wanted to add a css class to each individual image of the gallery in order to exploit flexbox but failed with <GalleryImg src={images/HLCCHL-Hall-Hire-1.jpg} className="some-css-class"/> so I targeted what Gatsby creates for you .gatsby-image-wrapper but I eventually realised it's a global class of course so all gatsby-images across the site had the same style of the gallery which was undesired so I need to go back to the drawing board on that 🤓!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant