Update to Gatsby 3

This commit is contained in:
LordMathis 2021-09-28 19:16:31 +02:00
parent a0c9f7d9a3
commit 23a2fd36fd
15 changed files with 4260 additions and 5994 deletions

View File

@ -5,26 +5,26 @@
"version": "2.0.0", "version": "2.0.0",
"author": "Matus Namesny <matus@namesny.com>", "author": "Matus Namesny <matus@namesny.com>",
"dependencies": { "dependencies": {
"@fontsource/fira-mono": "^4.2.2", "@fontsource/fira-mono": "^4.5.0",
"@fontsource/open-sans": "^4.2.2", "@fontsource/open-sans": "^4.5.1",
"gatsby": "^2.24.61", "gatsby": "^3.14.0",
"gatsby-image": "^2.4.19", "gatsby-image": "^3.11.0",
"gatsby-plugin-manifest": "^2.4.30", "gatsby-plugin-manifest": "^3.14.0",
"gatsby-plugin-offline": "^3.2.28", "gatsby-plugin-offline": "^4.14.0",
"gatsby-plugin-react-helmet": "^3.3.11", "gatsby-plugin-react-helmet": "^4.14.0",
"gatsby-plugin-sass": "^2.3.13", "gatsby-plugin-sass": "^4.14.0",
"gatsby-plugin-sharp": "^2.6.36", "gatsby-plugin-sharp": "^3.14.0",
"gatsby-source-filesystem": "^2.3.30", "gatsby-source-filesystem": "^3.14.0",
"gatsby-transformer-remark": "^2.8.35", "gatsby-transformer-remark": "^4.11.0",
"gatsby-transformer-sharp": "^2.5.15", "gatsby-transformer-sharp": "^3.14.0",
"node-sass": "^4.14.1", "node-sass": "^6.0.1",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.12.0", "react": "^17.0.2",
"react-dom": "^16.12.0", "react-dom": "^17.0.2",
"react-helmet": "^6.1.0" "react-helmet": "^6.1.0"
}, },
"devDependencies": { "devDependencies": {
"prettier": "2.1.1" "prettier": "2.4.1"
}, },
"keywords": [ "keywords": [
"gatsby", "gatsby",

View File

@ -1,6 +1,6 @@
import React from "react" import React from "react"
import PostLink from "./post-link" import PostLink from "./post-link"
import styles from "../styles/blog.module.scss" import {header} from "../styles/blog.module.scss"
const Blog = ({ edges }) => { const Blog = ({ edges }) => {
const Posts = edges const Posts = edges
@ -8,7 +8,7 @@ const Blog = ({ edges }) => {
return ( return (
<div> <div>
<div className={styles.header}> <div className={header}>
<h1>Blog</h1> <h1>Blog</h1>
</div> </div>
<div> <div>

View File

@ -1,11 +1,11 @@
import React from "react" import React from "react"
import styles from '../styles/footer.module.scss' import { footer, link } from '../styles/footer.module.scss'
const Footer = ({authorName}) => ( const Footer = ({authorName}) => (
<footer className={styles.footer}> <footer className={footer}>
© {new Date().getFullYear()} {authorName}, Built with © {new Date().getFullYear()} {authorName}, Built with
{` `} {` `}
<a href="https://www.gatsbyjs.org" className={styles.link}>Gatsby</a> <a href="https://www.gatsbyjs.org" className={link}>Gatsby</a>
</footer> </footer>
) )

View File

@ -1,15 +1,15 @@
import { Link } from "gatsby" import { Link } from "gatsby"
import PropTypes from "prop-types" import PropTypes from "prop-types"
import React from "react" import React from "react"
import styles from "../styles/header.module.scss" import { header, headerWrapper, terminal, links } from "../styles/header.module.scss"
const Header = ({ user, hostname }) => ( const Header = ({ user, hostname }) => (
<header className={styles.headerWrapper}> <header className={headerWrapper}>
<div className={styles.header}> <div className={header}>
<div> <div>
<Link to="/" className={styles.terminal}>{user}@{hostname} ~ $</Link> <Link to="/" className={terminal}>{user}@{hostname} ~ $</Link>
</div> </div>
<nav className={styles.links}> <nav className={links}>
<ul> <ul>
<li key="about"> <li key="about">
<a href='/about'> <a href='/about'>

View File

@ -1,13 +1,13 @@
import { Link } from "gatsby" import { Link } from "gatsby"
import PropTypes from "prop-types" import PropTypes from "prop-types"
import React from "react" import React from "react"
import styles from "../styles/index.module.scss" import { indexWrapper, header } from "../styles/index.module.scss"
import Social from "./social" import Social from "./social"
const Index = ({ author, social, email }) => ( const Index = ({ author, social, email }) => (
<div className={styles.indexWrapper}> <div className={indexWrapper}>
<div> <div>
<h1 className={styles.header}>{ author }</h1> <h1 className={header}>{ author }</h1>
</div> </div>
<Social social={social} email={email}/> <Social social={social} email={email}/>
</div> </div>

View File

@ -5,9 +5,10 @@ import { useStaticQuery, graphql } from "gatsby"
import Header from "./header" import Header from "./header"
import Footer from "./footer" import Footer from "./footer"
import { Helmet } from "react-helmet" import { Helmet } from "react-helmet"
import styles from "../styles/layout.module.scss" import '../styles/global.scss';
import { main, content, vertical, flexWrapper } from "../styles/layout.module.scss"
const Layout = ({ children, title, vertical}) => { const Layout = ({ children, title, verticalLayout}) => {
const data = useStaticQuery(graphql` const data = useStaticQuery(graphql`
query SiteTitleQuery { query SiteTitleQuery {
@ -20,10 +21,10 @@ const Layout = ({ children, title, vertical}) => {
} }
}`) }`)
const classes = vertical ? `${styles.content} ${styles.vertical}` : styles.content const classes = verticalLayout ? `${content} ${vertical}` : content
return ( return (
<div className={styles.flexWrapper}> <div className={flexWrapper}>
<Helmet <Helmet
titleTemplate={`%s | ${data.site.siteMetadata.author}`}> titleTemplate={`%s | ${data.site.siteMetadata.author}`}>
<html lang="en" amp /> <html lang="en" amp />
@ -33,7 +34,7 @@ const Layout = ({ children, title, vertical}) => {
user={data.site.siteMetadata.user} user={data.site.siteMetadata.user}
hostname={data.site.siteMetadata.hostname} /> hostname={data.site.siteMetadata.hostname} />
<div className={classes}> <div className={classes}>
<main className={styles.main}>{children}</main> <main className={main}>{children}</main>
</div> </div>
<Footer authorName={data.site.siteMetadata.author}/> <Footer authorName={data.site.siteMetadata.author}/>
</div> </div>

View File

@ -1,22 +1,22 @@
import React from "react" import React from "react"
import { Link } from "gatsby" import { Link } from "gatsby"
import styles from '../styles/post-link.module.scss' import { postTitle, postDate, postHeader, postListItem, postExcerpt } from '../styles/post-link.module.scss'
const PostLink = ({ post }) => { const PostLink = ({ post }) => {
const postDate = new Date(post.frontmatter.date) const date = new Date(post.frontmatter.date)
const options = { year: 'numeric', month: 'long', day: 'numeric' }; const options = { year: 'numeric', month: 'long', day: 'numeric' };
const postDateString = postDate.toLocaleDateString('en', options); const postDateString = date.toLocaleDateString('en', options);
const postUrl = "/posts" + post.fields.slug const postUrl = "/posts" + post.fields.slug
return ( return (
<Link to={postUrl}> <Link to={postUrl}>
<div className={styles.postListItem} role="listitem"> <div className={postListItem} role="listitem">
<div className={styles.postHeader} > <div className={postHeader} >
<span className={styles.postTitle}>{post.frontmatter.title}</span> <span className={postTitle}>{post.frontmatter.title}</span>
<span className={styles.postDate}>{postDateString}</span> <span className={postDate}>{postDateString}</span>
</div> </div>
<div className={styles.postExcerpt}> <div className={postExcerpt}>
<p>{post.excerpt}</p> <p>{post.excerpt}</p>
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import styles from '../styles/social.module.scss' import { socialNavbar } from '../styles/social.module.scss'
export default class Social extends Component { export default class Social extends Component {
static propTypes = { static propTypes = {
@ -33,7 +33,7 @@ export default class Social extends Component {
) )
return ( return (
<div className={styles.socialNavbar} role="list"> <div className={socialNavbar} role="list">
<ul> <ul>
{socialLinks} {socialLinks}
</ul> </ul>

View File

@ -1,7 +1,5 @@
import React from "react" import React from "react"
import Layout from "../components/layout"
const NotFoundPage = () => ( const NotFoundPage = () => (
<Layout title="404: Not found" > <Layout title="404: Not found" >
<h1>NOT FOUND</h1> <h1>NOT FOUND</h1>

View File

@ -4,8 +4,6 @@ import { useStaticQuery, graphql } from "gatsby"
import Layout from "../components/layout" import Layout from "../components/layout"
import Blog from "../components/blog" import Blog from "../components/blog"
import "../styles/global.scss"
const IndexPage = () => { const IndexPage = () => {
const data = useStaticQuery(graphql` const data = useStaticQuery(graphql`

View File

@ -2,8 +2,6 @@ import React from "react"
import { useStaticQuery, graphql } from "gatsby" import { useStaticQuery, graphql } from "gatsby"
import Layout from "../components/layout" import Layout from "../components/layout"
import "../styles/global.scss"
import Index from "../components" import Index from "../components"
const IndexPage = () => { const IndexPage = () => {

View File

@ -1,10 +1,10 @@
@import "./variables.scss"; @import "./variables.scss";
:global(body, html) { body, html {
height: 100%; height: 100%;
} }
:global(body) { body {
font-family: $fontParagraph; font-family: $fontParagraph;
color: $white; color: $white;
background-color: $backgroundDark; background-color: $backgroundDark;
@ -15,7 +15,7 @@
} }
@for $i from 1 through 6 { @for $i from 1 through 6 {
:global(h#{$i}) { h#{$i} {
font-family: $fontHeader; font-family: $fontHeader;
} }
} }

View File

@ -1,13 +1,13 @@
import React from "react" import React from "react"
import { graphql } from "gatsby" import { graphql } from "gatsby"
import Layout from "../components/layout" import Layout from "../components/layout"
import styles from "../styles/blog-post.module.scss" import { blogPostWrapper } from "../styles/blog-post.module.scss"
export default function BlogPost({ data }) { export default function BlogPost({ data }) {
const post = data.markdownRemark const post = data.markdownRemark
return ( return (
<Layout> <Layout>
<div className={styles.blogPostWrapper}> <div className={blogPostWrapper}>
<h1>{post.frontmatter.title}</h1> <h1>{post.frontmatter.title}</h1>
<div dangerouslySetInnerHTML={{ __html: post.html }} /> <div dangerouslySetInnerHTML={{ __html: post.html }} />
</div> </div>

View File

@ -1,13 +1,13 @@
import React from "react" import React from "react"
import { graphql } from "gatsby" import { graphql } from "gatsby"
import Layout from "../components/layout" import Layout from "../components/layout"
import styles from "../styles/page.module.scss" import {pageWrapper} from "../styles/page.module.scss"
export default function Page({ data }) { export default function Page({ data }) {
const page = data.markdownRemark const page = data.markdownRemark
return ( return (
<Layout> <Layout>
<div className={styles.pageWrapper}> <div className={pageWrapper}>
<h1>{page.frontmatter.title}</h1> <h1>{page.frontmatter.title}</h1>
<div dangerouslySetInnerHTML={{ __html: page.html }} /> <div dangerouslySetInnerHTML={{ __html: page.html }} />
</div> </div>

10145
yarn.lock

File diff suppressed because it is too large Load Diff