Sane defaults, please

This commit is contained in:
Hamcha 2020-01-23 16:10:37 +01:00
parent 6a2fa88cdf
commit bc5d108dde
Signed by: hamcha
GPG Key ID: 44AD3571EB09A39E
13 changed files with 973 additions and 139 deletions

View File

@ -1,6 +1,6 @@
{
"endOfLine": "lf",
"semi": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"

View File

@ -29,5 +29,20 @@ module.exports = {
},
`gatsby-plugin-typescript`,
`gatsby-plugin-sass`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `content`,
path: `${__dirname}/src/content`,
},
},
{
resolve: `gatsby-transformer-yaml-plus`,
options: {
enableRemark: true,
markdownPreface: "md//",
},
},
`gatsby-transformer-remark`,
],
}
};

View File

@ -13,13 +13,16 @@
"gatsby-plugin-sass": "^2.1.27",
"gatsby-plugin-sharp": "^2.3.5",
"gatsby-plugin-typescript": "^2.1.26",
"gatsby-source-filesystem": "^2.1.40",
"gatsby-source-filesystem": "^2.1.46",
"gatsby-transformer-remark": "^2.6.48",
"gatsby-transformer-sharp": "^2.3.7",
"gatsby-transformer-yaml-plus": "^0.2.2",
"node-sass": "^4.13.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1"
"react-helmet": "^5.2.1",
"remark-html": "^10.0.0"
},
"devDependencies": {
"@types/react": "^16.9.19",

View File

@ -1,11 +1,11 @@
import { Link } from "gatsby"
import PropTypes from "prop-types"
import React from "react"
import { Link } from "gatsby";
import PropTypes from "prop-types";
import React from "react";
const Header = ({ siteTitle }) => (
<header
id="header"
style={{
background: `rebeccapurple`,
marginBottom: `1.45rem`,
}}
>
@ -15,28 +15,16 @@ const Header = ({ siteTitle }) => (
maxWidth: 960,
padding: `1.45rem 1.0875rem`,
}}
>
<h1 style={{ margin: 0 }}>
<Link
to="/"
style={{
color: `white`,
textDecoration: `none`,
}}
>
{siteTitle}
</Link>
</h1>
</div>
></div>
</header>
)
);
Header.propTypes = {
siteTitle: PropTypes.string,
}
};
Header.defaultProps = {
siteTitle: ``,
}
};
export default Header
export default Header;

View File

@ -1,32 +0,0 @@
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import Img from "gatsby-image"
/*
* This component is built using `gatsby-image` to automatically serve optimized
* images with lazy loading and reduced file sizes. The image is loaded using a
* `useStaticQuery`, which allows us to load the image from directly within this
* component, rather than having to pass the image data down from pages.
*
* For more information, see the docs:
* - `gatsby-image`: https://gatsby.dev/gatsby-image
* - `useStaticQuery`: https://www.gatsbyjs.org/docs/use-static-query/
*/
const Image = () => {
const data = useStaticQuery(graphql`
query {
placeholderImage: file(relativePath: { eq: "gatsby-astronaut.png" }) {
childImageSharp {
fluid(maxWidth: 300) {
...GatsbyImageSharpFluid
}
}
}
}
`)
return <Img fluid={data.placeholderImage.childImageSharp.fluid} />
}
export default Image

View File

@ -1 +1,19 @@
@import "./normalize.scss";
@import "./normalize.scss";
body {
background-color: black;
color: white;
}
a {
color: white;
transition: all 100ms;
&:hover {}
}
#header {
a {
text-decoration: none;
}
}

View File

@ -5,12 +5,12 @@
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/
import React from "react"
import PropTypes from "prop-types"
import { useStaticQuery, graphql } from "gatsby"
import React from "react";
import PropTypes from "prop-types";
import { useStaticQuery, graphql } from "gatsby";
import Header from "./header"
import "./layout.scss"
import Header from "./header";
import "./layout.scss";
const Layout = ({ children }) => {
const data = useStaticQuery(graphql`
@ -21,7 +21,7 @@ const Layout = ({ children }) => {
}
}
}
`)
`);
return (
<>
@ -34,18 +34,13 @@ const Layout = ({ children }) => {
}}
>
<main>{children}</main>
<footer>
© {new Date().getFullYear()}, Built with
{` `}
<a href="https://www.gatsbyjs.org">Gatsby</a>
</footer>
</div>
</>
)
}
);
};
Layout.propTypes = {
children: PropTypes.node.isRequired,
}
};
export default Layout
export default Layout;

View File

@ -5,10 +5,10 @@
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/
import React from "react"
import PropTypes from "prop-types"
import Helmet from "react-helmet"
import { useStaticQuery, graphql } from "gatsby"
import React from "react";
import PropTypes from "prop-types";
import Helmet from "react-helmet";
import { useStaticQuery, graphql } from "gatsby";
function SEO({ description, lang, meta, title }) {
const { site } = useStaticQuery(
@ -23,9 +23,9 @@ function SEO({ description, lang, meta, title }) {
}
}
`
)
);
const metaDescription = description || site.siteMetadata.description
const metaDescription = description || site.siteMetadata.description;
return (
<Helmet
@ -69,20 +69,20 @@ function SEO({ description, lang, meta, title }) {
},
].concat(meta)}
/>
)
);
}
SEO.defaultProps = {
lang: `en`,
meta: [],
description: ``,
}
};
SEO.propTypes = {
description: PropTypes.string,
lang: PropTypes.string,
meta: PropTypes.arrayOf(PropTypes.object),
title: PropTypes.string.isRequired,
}
};
export default SEO
export default SEO;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

View File

@ -1,7 +1,7 @@
import React from "react"
import React from "react";
import Layout from "../components/layout"
import SEO from "../components/seo"
import Layout from "../components/layout";
import SEO from "../components/seo";
const NotFoundPage = () => (
<Layout>
@ -9,6 +9,6 @@ const NotFoundPage = () => (
<h1>NOT FOUND</h1>
<p>You just hit a route that doesn&#39;t exist... the sadness.</p>
</Layout>
)
);
export default NotFoundPage
export default NotFoundPage;

View File

@ -1,21 +1,12 @@
import React from "react"
import { Link } from "gatsby"
import React from "react";
import Layout from "../components/layout"
import Image from "../components/image"
import SEO from "../components/seo"
import Layout from "../components/layout";
import SEO from "../components/seo";
const IndexPage = () => (
<Layout>
<SEO title="Home" />
<h1>Hi people</h1>
<p>Welcome to your new Gatsby site.</p>
<p>Now go build something great.</p>
<div style={{ maxWidth: `300px`, marginBottom: `1.45rem` }}>
<Image />
</div>
<Link to="/page-2/">Go to page 2</Link>
</Layout>
)
);
export default IndexPage
export default IndexPage;

View File

@ -1,16 +0,0 @@
import React from "react"
import { Link } from "gatsby"
import Layout from "../components/layout"
import SEO from "../components/seo"
const SecondPage = () => (
<Layout>
<SEO title="Page two" />
<h1>Hi from the second page</h1>
<p>Welcome to page 2</p>
<Link to="/">Go back to the homepage</Link>
</Layout>
)
export default SecondPage

914
yarn.lock

File diff suppressed because it is too large Load Diff