Skip to content

Commit b5d3844

Browse files
authored
Merge pull request #45 from wiziple/versions/0.2.7
Versions/0.2.7
2 parents e358020 + 44f09ff commit b5d3844

File tree

12 files changed

+15264
-210
lines changed

12 files changed

+15264
-210
lines changed

examples/gatsby-starter-default-intl/package-lock.json

Lines changed: 14987 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/gatsby-starter-default-intl/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"name": "gatsby-starter-default-intl",
33
"private": true,
44
"description": "The default Gatsby starter using gatsby-plugin-intl for i18n.",
5-
"version": "0.2.1",
5+
"version": "0.2.7",
66
"author": "Daewoong Moon <wiziple@gmail.com>",
77
"dependencies": {
8-
"gatsby": "^2.11.5",
9-
"gatsby-image": "^2.2.3",
10-
"gatsby-plugin-intl": "^0.2.6",
11-
"gatsby-plugin-manifest": "^2.2.0",
12-
"gatsby-plugin-offline": "^2.2.0",
13-
"gatsby-plugin-react-helmet": "^3.1.0",
14-
"gatsby-plugin-sharp": "^2.2.1",
15-
"gatsby-source-filesystem": "^2.1.1",
16-
"gatsby-transformer-sharp": "^2.2.0",
8+
"gatsby": "2.13.39",
9+
"gatsby-image": "^2.2.6",
10+
"gatsby-plugin-intl": "^0.2.7",
11+
"gatsby-plugin-manifest": "^2.2.4",
12+
"gatsby-plugin-offline": "^2.2.4",
13+
"gatsby-plugin-react-helmet": "^3.1.2",
14+
"gatsby-plugin-sharp": "^2.2.9",
15+
"gatsby-source-filesystem": "^2.1.6",
16+
"gatsby-transformer-sharp": "^2.2.4",
1717
"prop-types": "^15.7.2",
1818
"react": "^16.8.6",
1919
"react-dom": "^16.8.6",
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
import React from "react"
2-
import { StaticQuery, graphql } from "gatsby"
2+
import { useStaticQuery, graphql } from "gatsby"
33
import Img from "gatsby-image"
44

55
/*
66
* This component is built using `gatsby-image` to automatically serve optimized
77
* images with lazy loading and reduced file sizes. The image is loaded using a
8-
* `StaticQuery`, which allows us to load the image from directly within this
8+
* `useStaticQuery`, which allows us to load the image from directly within this
99
* component, rather than having to pass the image data down from pages.
1010
*
1111
* For more information, see the docs:
1212
* - `gatsby-image`: https://gatsby.dev/gatsby-image
13-
* - `StaticQuery`: https://gatsby.dev/staticquery
13+
* - `useStaticQuery`: https://www.gatsbyjs.org/docs/use-static-query/
1414
*/
1515

16-
const Image = () => (
17-
<StaticQuery
18-
query={graphql`
19-
query {
20-
placeholderImage: file(relativePath: { eq: "gatsby-astronaut.png" }) {
21-
childImageSharp {
22-
fluid(maxWidth: 300) {
23-
...GatsbyImageSharpFluid
24-
}
16+
const Image = () => {
17+
const data = useStaticQuery(graphql`
18+
query {
19+
placeholderImage: file(relativePath: { eq: "gatsby-astronaut.png" }) {
20+
childImageSharp {
21+
fluid(maxWidth: 300) {
22+
...GatsbyImageSharpFluid
2523
}
2624
}
2725
}
28-
`}
29-
render={data => <Img fluid={data.placeholderImage.childImageSharp.fluid} />}
30-
/>
31-
)
26+
}
27+
`)
28+
29+
return <Img fluid={data.placeholderImage.childImageSharp.fluid} />
30+
}
31+
3232
export default Image
Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,53 @@
11
/**
22
* Layout component that queries for data
3-
* with Gatsby's StaticQuery component
3+
* with Gatsby's useStaticQuery component
44
*
5-
* See: https://www.gatsbyjs.org/docs/static-query/
5+
* See: https://www.gatsbyjs.org/docs/use-static-query/
66
*/
77

88
import React from "react"
99
import PropTypes from "prop-types"
10-
import { StaticQuery, graphql } from "gatsby"
10+
import { useStaticQuery, graphql } from "gatsby"
1111
import { injectIntl } from "gatsby-plugin-intl"
1212

1313
import Header from "./header"
1414
import "./layout.css"
1515

16-
const Layout = ({ children, intl }) => (
17-
<StaticQuery
18-
query={graphql`
19-
query SiteTitleQuery {
20-
site {
21-
siteMetadata {
22-
title
23-
}
16+
const Layout = ({ children, intl }) => {
17+
const data = useStaticQuery(graphql`
18+
query SiteTitleQuery {
19+
site {
20+
siteMetadata {
21+
title
2422
}
2523
}
26-
`}
27-
render={data => (
28-
<>
29-
<Header siteTitle={intl.formatMessage({ id: "title" })} />
30-
<div
31-
style={{
32-
margin: `0 auto`,
33-
maxWidth: 960,
34-
padding: `0px 1.0875rem 1.45rem`,
35-
paddingTop: 0,
36-
}}
37-
>
38-
<main>{children}</main>
39-
<footer>
40-
© {new Date().getFullYear()}, Built with
41-
{` `}
42-
<a href="https://www.gatsbyjs.org">Gatsby</a>
43-
</footer>
44-
</div>
45-
</>
46-
)}
47-
/>
48-
)
24+
}
25+
`)
26+
27+
return (
28+
<>
29+
<Header siteTitle={intl.formatMessage({ id: "title" })} />
30+
<div
31+
style={{
32+
margin: `0 auto`,
33+
maxWidth: 960,
34+
padding: `0px 1.0875rem 1.45rem`,
35+
paddingTop: 0,
36+
}}
37+
>
38+
<main>{children}</main>
39+
<footer>
40+
© {new Date().getFullYear()}, Built with
41+
{` `}
42+
<a href="https://www.gatsbyjs.org">Gatsby</a>
43+
</footer>
44+
</div>
45+
</>
46+
)
47+
}
4948

5049
Layout.propTypes = {
5150
children: PropTypes.node.isRequired,
52-
intl: PropTypes.object.isRequired,
5351
}
5452

5553
export default injectIntl(Layout)

examples/gatsby-starter-default-intl/src/components/seo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ SEO.defaultProps = {
8989
}
9090

9191
SEO.propTypes = {
92-
lang: PropTypes.string,
9392
description: PropTypes.string,
93+
lang: PropTypes.string,
9494
meta: PropTypes.arrayOf(PropTypes.object),
9595
keywords: PropTypes.arrayOf(PropTypes.string),
9696
title: PropTypes.string.isRequired,

examples/gatsby-starter-default-intl/src/images/gatsby-astronaut.png

100644100755
File mode changed.

examples/gatsby-starter-default-intl/src/images/gatsby-icon.png

100644100755
File mode changed.

0 commit comments

Comments
 (0)