diff --git a/.DS_Store b/.DS_Store
index 43ff0d6..a36a55c 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/gatsby/.eslintrc.js b/gatsby/.eslintrc.js
new file mode 100644
index 0000000..2778802
--- /dev/null
+++ b/gatsby/.eslintrc.js
@@ -0,0 +1,6 @@
+module.exports = {
+ globals: {
+ __PATH_PREFIX__: true,
+ },
+ extends: `react-app`,
+}
diff --git a/gatsby/data/gallery/_DSC4949.jpg b/gatsby/data/gallery/_DSC4949.jpg
new file mode 100644
index 0000000..c99de2d
Binary files /dev/null and b/gatsby/data/gallery/_DSC4949.jpg differ
diff --git a/gatsby/gatsby-node.js b/gatsby/gatsby-node.js
index 02daf8c..d8e11c8 100644
--- a/gatsby/gatsby-node.js
+++ b/gatsby/gatsby-node.js
@@ -1,5 +1,6 @@
const fs = require('fs');
-const util = require('util')
+const util = require('util');
+const path = require('path');
const { read } = require('fast-exif');
const iptc = require('node-iptc');
@@ -34,14 +35,12 @@ function transformMetaToNodeData(exifData, iptcData) {
);
}
}
-
+
return {
exif: exifData?.exif,
gps,
- meta: {
- dateTaken: exifData?.exif?.DateTimeOriginal
- },
+ dateTaken: exifData?.exif?.DateTimeOriginal,
iptc: iptcData || undefined
};
}
@@ -61,4 +60,45 @@ exports.onCreateNode = async function ({ node, getNode, actions }) {
value: transformMetaToNodeData(exifData, iptcData)
});
}
+}
+
+// Implement the Gatsby API “createPages”. This is called once the
+// data layer is bootstrapped to let plugins create pages from data.
+exports.createPages = async ({ graphql, actions, reporter }) => {
+ const { createPage } = actions;
+ // get all images
+ const galleryImages = await graphql(
+ `
+ {
+ allFile(filter: {
+ sourceInstanceName: { eq: "gallery" }}) {
+ edges {
+ node {
+ relativePath,
+ base
+ }
+ }
+ }
+ }
+ `
+ )
+ // Handle errors
+ if (galleryImages.errors) {
+ reporter.panicOnBuild(`Error while running GraphQL query.`)
+ return
+ }
+ // Create pages for each markdown file.
+ const galleryImageTemplate = path.resolve(`src/templates/gallery-image.js`)
+ galleryImages.data.allFile.edges.forEach(({ node }) => {
+ // const path = node.base
+ createPage({
+ path: `gallery/${node.base}`,
+ component: galleryImageTemplate,
+ // In your blog post template's graphql query, you can use pagePath
+ // as a GraphQL variable to query for data from the markdown file.
+ context: {
+ imageFilename: node.base,
+ },
+ })
+ })
}
\ No newline at end of file
diff --git a/gatsby/package-lock.json b/gatsby/package-lock.json
index 38553f5..32daa2c 100644
--- a/gatsby/package-lock.json
+++ b/gatsby/package-lock.json
@@ -31,6 +31,9 @@
"sass": "^1.34.0",
"styled-components": "^5.3.0",
"tailwindcss": "^2.1.2"
+ },
+ "devDependencies": {
+ "eslint-config-react-app": "^6.0.0"
}
},
"node_modules/@ardatan/aggregate-error": {
diff --git a/gatsby/package.json b/gatsby/package.json
index c6eaf00..7402ec6 100644
--- a/gatsby/package.json
+++ b/gatsby/package.json
@@ -38,5 +38,8 @@
"sass": "^1.34.0",
"styled-components": "^5.3.0",
"tailwindcss": "^2.1.2"
+ },
+ "devDependencies": {
+ "eslint-config-react-app": "^6.0.0"
}
}
diff --git a/gatsby/src/pages/gallery.js b/gatsby/src/pages/gallery.js
new file mode 100644
index 0000000..603402b
--- /dev/null
+++ b/gatsby/src/pages/gallery.js
@@ -0,0 +1,97 @@
+import * as React from "react"
+import { graphql, Link } from 'gatsby'
+import { GatsbyImage, getImage } from "gatsby-plugin-image"
+import { getMeta } from "../utils"
+
+
+const GalleryPage = ({ data }) => {
+ const images = React.useMemo(() =>
+ data.allFile.edges
+ .map(edge => edge.node, [data])
+ .sort((left, right) => {
+ const leftDate = new Date(getMeta(left).dateTaken)
+ console.log(leftDate)
+ const rightDate = new Date(getMeta(right).dateTaken)
+ if (leftDate < rightDate) {
+ return 1;
+ }
+ if (leftDate > rightDate) {
+ return -1;
+ }
+ return 0;
+ }) // TODO HERE
+ , data)
+ return (
+
+
Gallery
+ {images.map(image => {
+ console.log('ar', image.childImageSharp)
+ const name = getMeta(image).iptc.object_name || image.base
+ // const {
+ // name: object_name,
+ // aspectRatio
+ // }
+ // const file = data.allFile
+ // console.log(fileName)
+ // return <>>
+ return (
+ //
+ // .
+ <>
+
+ {/* {name} */}
+
+
+ >
+ );
+ })}
+
)
+}
+
+export const query = graphql`
+query GalleryPageQuery {
+ allFile(filter: {
+ sourceInstanceName: { eq: "gallery" }}) {
+ edges {
+ node {
+ relativePath,
+ base,
+ childImageSharp{
+ fluid {
+ aspectRatio
+ },
+ gatsbyImageData(
+ layout: CONSTRAINED,
+ width: 400
+ )
+ fields {
+ imageMeta {
+ dateTaken
+ iptc {
+ caption
+ object_name
+ }
+ exif {
+ FNumber
+ ExposureTime
+ ShutterSpeedValue
+ ISO
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}`;
+
+export default GalleryPage
\ No newline at end of file
diff --git a/gatsby/src/pages/index.js b/gatsby/src/pages/index.js
index 1e587f1..0111330 100644
--- a/gatsby/src/pages/index.js
+++ b/gatsby/src/pages/index.js
@@ -13,10 +13,10 @@ const IndexPage = ({ data }) => {
return (
-
+
-
Chuck Dries
-
Software Engineer in web & VR
+
Chuck Dries
+
Software Engineer in web & VR
- Software Developer, Axosoft
- chuck@chuckdries.com / 602.618.0414
@@ -39,8 +39,8 @@ const IndexPage = ({ data }) => {
🎉🎉🎉
*/}
-
- Photography
+
+ Photography
{images.map(image => {
const name = image.childImageSharp.fields.imageMeta.iptc.object_name || image.base
@@ -81,16 +81,14 @@ query HomePageGallery {
childImageSharp{
gatsbyImageData(
layout: CONSTRAINED,
- placeholder: BLURRED,
+ placeholder: DOMINANT_COLOR,
# width: 400
# height: 900
- height: 400
+ height: 600
)
fields {
imageMeta {
- meta {
- dateTaken
- }
+ dateTaken
iptc {
caption
object_name
diff --git a/gatsby/src/styles/global.css b/gatsby/src/styles/global.css
index 11c1c07..ed2fbcd 100644
--- a/gatsby/src/styles/global.css
+++ b/gatsby/src/styles/global.css
@@ -1,3 +1,5 @@
+@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital@0;1&display=swap');
+
@tailwind base;
@tailwind components;
@tailwind utilities;
@@ -27,5 +29,7 @@
margin-left: theme('spacing.6')
}
body {
- @apply bg-gray-900 text-white;
-}
\ No newline at end of file
+ @apply bg-gray-100;
+ /* @apply bg-black; */
+ @apply text-white;
+}
diff --git a/gatsby/src/templates/gallery-image.js b/gatsby/src/templates/gallery-image.js
new file mode 100644
index 0000000..717cfc6
--- /dev/null
+++ b/gatsby/src/templates/gallery-image.js
@@ -0,0 +1,68 @@
+import React from "react"
+import { graphql } from 'gatsby'
+import { getMeta, getName } from "../utils";
+import { GatsbyImage, getImage } from "gatsby-plugin-image"
+
+const GalleryImage = ({ pageContext, data }) => {
+ const image = data.allFile.edges[0].node
+ console.log(getMeta(image));
+ const name = getName(image);
+ return (
+
+
{name}
+
+
{getMeta(image).iptc.caption}
+
+ );
+}
+
+export const query = graphql`
+ query GalleryImage($imageFilename: String) {
+ allFile(filter: {sourceInstanceName: {eq: "gallery"}, base: {eq: $imageFilename}}) {
+ edges {
+ node {
+ relativePath
+ base
+ childImageSharp{
+ fluid {
+ aspectRatio
+ }
+ gatsbyImageData(
+ layout: FULL_WIDTH
+ placeholder: BLURRED
+ # width: 400
+ )
+ fields {
+ imageMeta {
+ dateTaken
+ iptc {
+ caption
+ object_name
+ }
+ exif {
+ FNumber
+ ExposureTime
+ ShutterSpeedValue
+ ISO
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+
+`
+
+export default GalleryImage
\ No newline at end of file
diff --git a/gatsby/src/utils.js b/gatsby/src/utils.js
new file mode 100644
index 0000000..e0f076a
--- /dev/null
+++ b/gatsby/src/utils.js
@@ -0,0 +1,3 @@
+export const getMeta = (image) => image.childImageSharp.fields.imageMeta
+
+export const getName = (image) => getMeta(image).iptc.object_name || image.base
\ No newline at end of file
diff --git a/gatsby/tailwind.config.js b/gatsby/tailwind.config.js
index 2d4eeb8..23f097a 100644
--- a/gatsby/tailwind.config.js
+++ b/gatsby/tailwind.config.js
@@ -17,7 +17,7 @@ module.exports = {
fontFamily: {
...defaultTheme.fontFamily,
// serif: ['Didot', 'Didot LT', 'STD', 'Hoefler Text' , 'Garamond', 'Times New Roman', 'serif']
- serif: ['Baskerville', 'Baskerville Old Face', 'Hoefler Text' , 'Garamond', 'Times New Roman', 'serif']
+ serif: ['Playfair Display', 'serif']
},
extend: {},
},