diff --git a/gatsby/.eslintrc.js b/gatsby/.eslintrc.js index 9559d87..4006ce1 100644 --- a/gatsby/.eslintrc.js +++ b/gatsby/.eslintrc.js @@ -18,6 +18,7 @@ module.exports = { ], 'rules': { 'react/prop-types': 0, - 'quotes': ['warn', 'single'] + 'quotes': ['warn', 'single'], + 'semi': 1 } -} +}; diff --git a/gatsby/gatsby-browser.js b/gatsby/gatsby-browser.js index 387e300..16a3a4d 100644 --- a/gatsby/gatsby-browser.js +++ b/gatsby/gatsby-browser.js @@ -1 +1,17 @@ -import './src/styles/global.css'; \ No newline at end of file +import './src/styles/global.css'; +// import * as React from 'react'; +// import { MDXProvider } from '@mdx-js/react'; + +// const MyH1 = props =>

; +// const MyParagraph = props => ( +//

+// ); + +// const components = { +// h1: MyH1, +// p: MyParagraph, +// }; + +// export const wrapRootElement = ({ element }) => ( +// {element} +// ); diff --git a/gatsby/gatsby-node.js b/gatsby/gatsby-node.js index b1dc6e5..a1e4d02 100644 --- a/gatsby/gatsby-node.js +++ b/gatsby/gatsby-node.js @@ -4,7 +4,7 @@ const path = require('path'); const { read } = require('fast-exif'); const iptc = require('node-iptc'); -const readFile = util.promisify(fs.readFile) +const readFile = util.promisify(fs.readFile); function convertDMSToDD(dms, positiveDirection) { @@ -51,16 +51,16 @@ exports.onCreateNode = async function ({ node, getNode, actions }) { if (node.internal.type === 'ImageSharp') { const parent = getNode(node.parent); - const file = await readFile(parent.absolutePath) - const iptcData = iptc(file) - const exifData = await read(parent.absolutePath) + const file = await readFile(parent.absolutePath); + const iptcData = iptc(file); + const exifData = await read(parent.absolutePath); createNodeField({ node, name: 'imageMeta', 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. @@ -81,14 +81,14 @@ exports.createPages = async ({ graphql, actions, reporter }) => { } } ` - ) + ); // Handle errors if (galleryImages.errors) { - reporter.panicOnBuild('Error while running GraphQL query.') - return + reporter.panicOnBuild('Error while running GraphQL query.'); + return; } // Create pages for each markdown file. - const galleryImageTemplate = path.resolve('src/components/gallery-image.js') + const galleryImageTemplate = path.resolve('src/components/gallery-image.js'); galleryImages.data.allFile.edges.forEach(({ node }) => { // const path = node.base createPage({ @@ -99,6 +99,6 @@ exports.createPages = async ({ graphql, actions, reporter }) => { context: { imageFilename: node.base, }, - }) - }) -} + }); + }); +}; diff --git a/gatsby/src/components/resume-layout.js b/gatsby/src/components/resume-layout.js new file mode 100644 index 0000000..bea8ca2 --- /dev/null +++ b/gatsby/src/components/resume-layout.js @@ -0,0 +1,13 @@ +import * as React from 'react'; +import classnames from 'classnames'; + +import '../styles/resume.css'; + +const ResumeLayout = ({ pageContext, children }) => { + console.log('pc', pageContext); + return (

{children}
); +}; + +// TODO: can I use custom components for just this layout/page? + +export default ResumeLayout; diff --git a/gatsby/src/pages/index.js b/gatsby/src/pages/index.js index 45f6b5b..602ff89 100644 --- a/gatsby/src/pages/index.js +++ b/gatsby/src/pages/index.js @@ -1,11 +1,11 @@ -import * as React from 'react' -import { graphql, Link } from 'gatsby' -import { GatsbyImage, getImage } from 'gatsby-plugin-image' +import * as React from 'react'; +import { graphql, Link } from 'gatsby'; +import { GatsbyImage, getImage } from 'gatsby-plugin-image'; // markup const IndexPage = ({ data }) => { - const images = React.useMemo(() => data.allFile.edges.map(edge => edge.node), [data]) - console.log('images', images) + const images = React.useMemo(() => data.allFile.edges.map(edge => edge.node), [data]); + console.log('images', images); return (
@@ -27,20 +27,12 @@ const IndexPage = ({ data }) => { - {/*

- Congratulations -
- โ€” you just made a Gatsby site! - - ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ - -

*/}

Photography

{images.map(image => { - const name = image.childImageSharp.fields.imageMeta.iptc.object_name || image.base - console.log('name', name) + const name = image.childImageSharp.fields.imageMeta.iptc.object_name || image.base; + console.log('name', name); // const file = data.allFile // console.log(fileName) // return <> @@ -63,8 +55,8 @@ const IndexPage = ({ data }) => {
- ) -} + ); +}; export const query = graphql` query HomePageGallery { @@ -103,4 +95,4 @@ query HomePageGallery { } }`; -export default IndexPage +export default IndexPage; diff --git a/gatsby/src/pages/photogallery.js b/gatsby/src/pages/photogallery.js index ea97285..a9201be 100644 --- a/gatsby/src/pages/photogallery.js +++ b/gatsby/src/pages/photogallery.js @@ -1,19 +1,19 @@ -import * as React from 'react' -import { graphql, Link } from 'gatsby' -import { GatsbyImage, getImage } from 'gatsby-plugin-image' -import { Helmet } from 'react-helmet' -import Masonry, { ResponsiveMasonry } from 'react-responsive-masonry' +import * as React from 'react'; +import { graphql, Link } from 'gatsby'; +import { GatsbyImage, getImage } from 'gatsby-plugin-image'; +import { Helmet } from 'react-helmet'; +import Masonry, { ResponsiveMasonry } from 'react-responsive-masonry'; -import { getMeta } from '../utils' +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) + const leftDate = new Date(getMeta(left).dateTaken); + console.log(leftDate); + const rightDate = new Date(getMeta(right).dateTaken); if (leftDate < rightDate) { return 1; } @@ -22,7 +22,7 @@ const GalleryPage = ({ data }) => { } return 0; }) // TODO HERE - , [data]) + , [data]); return (<> @@ -39,8 +39,8 @@ const GalleryPage = ({ data }) => { > {images.map(image => { - console.log('ar', image.childImageSharp) - const name = getMeta(image).iptc.object_name || image.base + console.log('ar', image.childImageSharp); + const name = getMeta(image).iptc.object_name || image.base; return ( @@ -56,8 +56,8 @@ const GalleryPage = ({ data }) => { - ) -} + ); +}; export const query = graphql` query GalleryPageQuery { @@ -96,4 +96,4 @@ query GalleryPageQuery { } }`; -export default GalleryPage +export default GalleryPage; diff --git a/gatsby/src/pages/resume.mdx b/gatsby/src/pages/resume.mdx index 5b5a4f2..06275c9 100644 --- a/gatsby/src/pages/resume.mdx +++ b/gatsby/src/pages/resume.mdx @@ -2,6 +2,9 @@ title: Charles Dries Resume --- +import ResumeLayout from '../components/resume-layout' +export default ResumeLayout + # Hello, World! -

{props.pageContext.frontmatter.title}

+

{props.pageContext.frontmatter.title}

diff --git a/gatsby/src/styles/global.css b/gatsby/src/styles/global.css index a0b4019..f0f4c36 100644 --- a/gatsby/src/styles/global.css +++ b/gatsby/src/styles/global.css @@ -28,7 +28,7 @@ body { @apply bg-gray-100; /* @apply bg-black; */ - @apply text-white; + /* @apply text-white; */ } h1 { diff --git a/gatsby/src/styles/resume.css b/gatsby/src/styles/resume.css new file mode 100644 index 0000000..df52805 --- /dev/null +++ b/gatsby/src/styles/resume.css @@ -0,0 +1,7 @@ +.resume { + background: green; +} +.resume h1 { + @apply text-3xl font-bold; +} + diff --git a/gatsby/tailwind.config.js b/gatsby/tailwind.config.js index 23f097a..dce82a5 100644 --- a/gatsby/tailwind.config.js +++ b/gatsby/tailwind.config.js @@ -2,7 +2,7 @@ const defaultTheme = require('tailwindcss/defaultTheme') module.exports = { purge: ['./src/**/*.{js,jsx,ts,tsx}'], - darkMode: 'media', // or 'media' or 'class' + // darkMode: 'media', // or 'media' or 'class' theme: { spacing: { '1': '8px',