From b80faa6f50df1e195f1b30dec18baf90f2c1b234 Mon Sep 17 00:00:00 2001 From: neri Date: Sat, 15 May 2021 22:08:57 +0200 Subject: [PATCH] upgrade to gatsby 3, add gatsby image component --- gatsby-config.js | 33 +- package.json | 19 +- src/components/accordion.js | 4 +- src/components/footer.js | 48 +- src/components/layout.js | 22 +- src/components/nav.js | 28 +- src/components/nav.module.css | 5 +- src/components/nextTopic.js | 2 +- src/components/osmMap.js | 10 +- src/components/roomState.js | 2 +- {static => src/images}/header.jpg | Bin {static => src/images}/logo_ctdo.svg | 0 src/styles/fonts.css | 4 + src/templates/blogTemplate.js | 27 +- src/templates/siteTemplate.js | 25 +- src/webpages/home.md | 4 +- yarn.lock | 11936 ++++++++++++++----------- 17 files changed, 7004 insertions(+), 5165 deletions(-) rename {static => src/images}/header.jpg (100%) rename {static => src/images}/logo_ctdo.svg (100%) diff --git a/gatsby-config.js b/gatsby-config.js index 7ae8799..c762d93 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -5,28 +5,45 @@ */ module.exports = { - pathPrefix: `/ctdo`, + pathPrefix: '/ctdo', plugins: [ { - resolve: `gatsby-source-filesystem`, + resolve: 'gatsby-source-filesystem', options: { - name: `pages`, + name: 'pages', path: `${__dirname}/src/webpages`, }, }, { - resolve: `gatsby-source-filesystem`, + resolve: 'gatsby-source-filesystem', options: { - name: `blog`, + name: 'blog', path: `${__dirname}/blog`, }, }, { - resolve: `gatsby-plugin-mdx`, + resolve: `gatsby-source-filesystem`, options: { - extensions: [`.mdx`, `.md`], - gatsbyRemarkPlugins: [], + path: `${__dirname}/src/images`, }, }, + { + resolve: 'gatsby-plugin-mdx', + options: { + extensions: ['.mdx', '.md'], + gatsbyRemarkPlugins: [ + { + resolve: `gatsby-remark-images`, + options: { + maxWidth: 1000, + pathPrefix: '/ctdo', + }, + }, + ], + }, + }, + 'gatsby-plugin-sharp', + 'gatsby-plugin-image', + `gatsby-plugin-react-helmet`, ], } diff --git a/package.json b/package.json index abb0517..34c238e 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,19 @@ "dependencies": { "@mdx-js/mdx": "^1.5.1", "@mdx-js/react": "^1.5.1", - "gatsby": "^2.18.8", - "gatsby-plugin-mdx": "^1.0.62", - "gatsby-source-filesystem": "^2.1.42", - "gatsby-transformer-remark": "^2.6.42", - "react": "^16.12.0", - "react-dom": "^16.12.0" + "gatsby": "^3.5.0", + "gatsby-plugin-image": "^1.5.0", + "gatsby-plugin-mdx": "^2.5.0", + "gatsby-plugin-react-helmet": "^4.5.0", + "gatsby-plugin-sharp": "^3.5.0", + "gatsby-remark-images": "^5.2.0", + "gatsby-source-filesystem": "^3.5.0", + "gatsby-transformer-remark": "^4.2.0", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "react-helmet": "^6.1.0" }, "devDependencies": { - "prettier": "^1.19.1" + "prettier": "^2.3.0" } } diff --git a/src/components/accordion.js b/src/components/accordion.js index 72026b3..09263f8 100644 --- a/src/components/accordion.js +++ b/src/components/accordion.js @@ -1,7 +1,7 @@ import React from "react" -import accordionStyles from "./accordion.module.css" +import * as accordionStyles from "./accordion.module.css" -export default ({ title, children }) => { +export default function Accordion({ title, children }) { return (
diff --git a/src/components/footer.js b/src/components/footer.js index cca20c0..946f8c4 100644 --- a/src/components/footer.js +++ b/src/components/footer.js @@ -1,26 +1,28 @@ import React from "react" -import footerStyles from "./footer.module.css" +import * as footerStyles from "./footer.module.css" import { Link } from "gatsby" -export default ({ editLink }) => ( - -) +export default function Footer({ editLink }) { + return ( + + ) +} diff --git a/src/components/layout.js b/src/components/layout.js index add70fe..c83a64d 100644 --- a/src/components/layout.js +++ b/src/components/layout.js @@ -1,14 +1,16 @@ import React from 'react' import Nav from '../components/nav' import Footer from '../components/footer' -import layoutStyles from './layout.module.css' +import * as layoutStyles from './layout.module.css' -export default ({ path, editLink, children }) => ( - <> -