Skip to content

Commit de9cd5a

Browse files
committed
docs: update examples
1 parent 2730d0f commit de9cd5a

File tree

10 files changed

+1904
-2759
lines changed

10 files changed

+1904
-2759
lines changed

examples/basic/gatsby-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ module.exports = {
55
{
66
resolve: require.resolve(`../..`),
77
options: {
8-
folder: process.env.GOOGLE_DOCS_FOLDER,
8+
// https://drive.google.com/drive/folders/1YJWX_FRoVusp-51ztedm6HSZqpbJA3ag
9+
folder: "1YJWX_FRoVusp-51ztedm6HSZqpbJA3ag",
910
createPages: true,
10-
keepDefaultStyle: true,
1111
},
1212
},
1313
"gatsby-plugin-sharp",

examples/basic/src/pages/index.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

examples/website/gatsby-config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ module.exports = {
99
// resolve: "gatsby-source-google-docs",
1010
resolve: require.resolve(`../..`),
1111
options: {
12-
folder: process.env.GOOGLE_DOCS_FOLDER,
12+
// https://drive.google.com/drive/folders/1YJWX_FRoVusp-51ztedm6HSZqpbJA3ag
13+
folder: "1YJWX_FRoVusp-51ztedm6HSZqpbJA3ag",
1314
// --------
1415
// Optional
1516
// --------
1617
debug: false,
1718
createPages: true,
18-
skipImages: DEV ? true : false,
19+
// skipImages: DEV ? true : false,
1920
imagesOptions: {
2021
width: DEV ? 512 : 1024,
2122
},

examples/website/package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,25 @@
1212
"dependencies": {
1313
"@mdx-js/mdx": "^1.6.22",
1414
"@mdx-js/react": "^1.6.22",
15-
"gatsby": "^2.24.66",
16-
"gatsby-image": "^2.4.20",
17-
"gatsby-plugin-catch-links": "^2.10.0",
18-
"gatsby-plugin-eslint": "^2.0.8",
19-
"gatsby-plugin-layout": "^1.7.0",
20-
"gatsby-plugin-mdx": "^1.7.1",
21-
"gatsby-plugin-mdx-embed": "^0.0.17",
15+
"gatsby": "^3.0.3",
16+
"gatsby-plugin-catch-links": "^3.0.0",
17+
"gatsby-plugin-eslint": "^3.0.0",
18+
"gatsby-plugin-image": "^1.0.0",
19+
"gatsby-plugin-layout": "^2.0.0",
20+
"gatsby-plugin-mdx": "^2.0.0",
21+
"gatsby-plugin-mdx-embed": "^0.0.19",
2222
"gatsby-plugin-react-svg": "^3.0.0",
23-
"gatsby-plugin-sharp": "^2.6.37",
23+
"gatsby-plugin-sharp": "^3.0.0",
2424
"gatsby-plugin-theme-ui": "^0.3.5",
25+
"gatsby-plugin-webfonts": "^2.0.0",
2526
"gatsby-remark-gifs": "^1.0.0",
26-
"gatsby-remark-images": "^3.3.31",
27-
"gatsby-remark-prismjs": "^3.5.14",
27+
"gatsby-remark-images": "^4.0.0",
28+
"gatsby-remark-prismjs": "^4.0.0",
2829
"gatsby-remark-unwrap-images": "^1.0.2",
29-
"gatsby-transformer-remark": "^2.8.36",
30-
"gatsby-transformer-sharp": "^2.5.16",
31-
"mdx-embed": "^0.0.17",
32-
"prismjs": "^1.21.0",
30+
"gatsby-transformer-remark": "^3.0.0",
31+
"gatsby-transformer-sharp": "^3.0.0",
32+
"mdx-embed": "^0.0.19",
33+
"prismjs": "^1.23.0",
3334
"react": "link:../node_modules/react",
3435
"react-dom": "link:../node_modules/react-dom",
3536
"react-icons": "^4.2.0",

examples/website/src/components/menu.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const Menu = ({open, onClose}) => {
2323
onKeyDown={onClose}
2424
role="button"
2525
tabIndex="0"
26-
ariaLabel="Close menu"
2726
sx={{
2827
position: "fixed",
2928
top: 0,
@@ -33,13 +32,15 @@ export const Menu = ({open, onClose}) => {
3332
bg: "black",
3433
opacity: "0.5",
3534
display: open ? "block" : "none",
35+
zIndex: 1,
3636
}}
3737
>
3838
{" "}
3939
</div>
4040
{/* Sidebar */}
4141
<div
4242
sx={{
43+
zIndex: 2,
4344
position: "fixed",
4445
top: 0,
4546
left: 0,

examples/website/src/gatsby-plugin-theme-ui/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const gradientBackground = (theme) =>
22
`linear-gradient(to right, ${theme.colors.primary}, ${theme.colors.secondary})`
33

4-
export default {
4+
const theme = {
55
space: [0, 8, 16, 32, 64],
66
radii: [0, 10, 20],
77
breakpoints: ["500px", "800px", "1080px"],
@@ -84,3 +84,5 @@ export default {
8484
},
8585
},
8686
}
87+
88+
export default theme

examples/website/src/layouts/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {GatsbyLogo} from "../components/gatsby-logo"
1111
import {Grid} from "../components/grid"
1212
import {Menu} from "../components/menu"
1313

14-
export default ({children}) => {
14+
const LayoutIndex = ({children}) => {
1515
const [isMenuOpen, setIsMenuOpen] = useState(false)
1616
const [colorMode, setColorMode] = useColorMode()
1717
const location = useLocation()
@@ -52,7 +52,6 @@ export default ({children}) => {
5252
onKeyDown={() => setIsMenuOpen(!isMenuOpen)}
5353
role="button"
5454
tabIndex="0"
55-
ariaLabel="Toggle Menu"
5655
>
5756
<RiMenuLine />
5857
</div>
@@ -94,8 +93,6 @@ export default ({children}) => {
9493
<Menu open={isMenuOpen} onClose={() => setIsMenuOpen(false)} />
9594
<div
9695
sx={{
97-
display: "flex",
98-
flexDirection: "column",
9996
"& > p": {
10097
mb: 0,
10198
},
@@ -155,3 +152,5 @@ export default ({children}) => {
155152
</div>
156153
)
157154
}
155+
156+
export default LayoutIndex

examples/website/src/pages/404.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Link} from "gatsby"
22
import React from "react"
33

4-
export default () => {
4+
const Page404 = () => {
55
return (
66
<main>
77
<Link to="/">
@@ -11,3 +11,5 @@ export default () => {
1111
</main>
1212
)
1313
}
14+
15+
export default Page404

examples/website/src/templates/page.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
import {graphql} from "gatsby"
2-
import Img from "gatsby-image"
2+
import {GatsbyImage, getImage} from "gatsby-plugin-image"
33
import {MDXRenderer} from "gatsby-plugin-mdx"
44
import React from "react"
55
import {Styled} from "theme-ui"
66
/** @jsx jsx */
77
import {jsx} from "theme-ui"
88

9-
export default ({
9+
const H1 = Styled.h1
10+
11+
const PageTemplate = ({
1012
data: {
1113
page: {name, cover, childMdx},
1214
},
1315
}) => {
16+
console.log(cover)
1417
return (
1518
<React.Fragment>
16-
<Styled.h1>{name}</Styled.h1>
19+
<H1>{name}</H1>
1720
{/*
1821
To add a cover:
1922
Add an image in your Google Doc first page header
2023
https://support.google.com/docs/answer/86629
2124
*/}
22-
{cover && <Img fluid={cover.image.childImageSharp.fluid} />}
25+
{cover && <GatsbyImage image={getImage(cover.image)} />}
2326
<MDXRenderer>{childMdx.body}</MDXRenderer>
2427
</React.Fragment>
2528
)
2629
}
2730

31+
export default PageTemplate
32+
2833
export const pageQuery = graphql`
2934
query Page($path: String!) {
3035
page: googleDocs(slug: {eq: $path}) {
3136
name
3237
cover {
3338
image {
3439
childImageSharp {
35-
fluid(maxWidth: 500, quality: 100) {
36-
...GatsbyImageSharpFluid
37-
}
40+
gatsbyImageData(placeholder: BLURRED)
3841
}
3942
}
4043
}

0 commit comments

Comments
 (0)