generated from queen-raae/gatsby-plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for non gatsby image cdn thumbnails (#11)
- Loading branch information
Showing
11 changed files
with
3,246 additions
and
2,205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
plugins: [ | ||
{ | ||
resolve: "@raae/gatsby-source-youtube-oembed", | ||
options: { | ||
youTubeIds: [ | ||
"Bk1jonYPFD4", | ||
"TzJfepDjpzM", | ||
"UsSJ_QNp6uo", | ||
"TX5XPuHhz9o", | ||
], | ||
thumbnailMode: "download", | ||
}, | ||
}, | ||
"gatsby-plugin-sharp", | ||
"gatsby-transformer-sharp", | ||
"gatsby-plugin-gatsby-cloud", | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "demo-download", | ||
"version": "1.0.0", | ||
"private": true, | ||
"description": "@raae/gatsby-source-youtube-oembed demo", | ||
"author": "@raae", | ||
"keywords": [ | ||
"gatsby" | ||
], | ||
"scripts": { | ||
"develop": "gatsby develop", | ||
"start": "gatsby develop", | ||
"build": "gatsby build", | ||
"serve": "gatsby serve", | ||
"clean": "gatsby clean" | ||
}, | ||
"dependencies": { | ||
"@raae/gatsby-source-youtube-oembed": "*", | ||
"gatsby": "4", | ||
"gatsby-plugin-gatsby-cloud": "4.11.0", | ||
"gatsby-plugin-image": "2.10.1", | ||
"gatsby-plugin-sharp": "4.10.2", | ||
"gatsby-transformer-sharp": "4.10.0", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from "react"; | ||
import { Link } from "gatsby"; | ||
|
||
const NotFoundPage = () => { | ||
return ( | ||
<main> | ||
<header> | ||
<h1>Page not found</h1> | ||
</header> | ||
<p> | ||
Sorry{" "} | ||
<span role="img" aria-label="Pensive emoji"> | ||
😔 | ||
</span>{" "} | ||
we couldn’t find what you were looking for. | ||
<br /> | ||
<Link to="/">Go home</Link>. | ||
</p> | ||
</main> | ||
); | ||
}; | ||
|
||
export default NotFoundPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React from "react"; | ||
import { graphql } from "gatsby"; | ||
import { GatsbyImage, getImage } from "gatsby-plugin-image"; | ||
|
||
const IndexPage = ({ data }) => { | ||
const { allYouTube } = data; | ||
return ( | ||
<main> | ||
<header> | ||
<h1> | ||
<span role="img" aria-label="Party popper emoji"> | ||
🎉 | ||
</span> | ||
gatsby-source-youtube-oembed | ||
<span role="img" aria-label="Party popper emoji"> | ||
🎉 | ||
</span> | ||
</h1> | ||
<div> | ||
{allYouTube.nodes.map((video) => { | ||
const { youTubeId, oEmbed, thumbnail } = video; | ||
console.log(video); | ||
const gatsbyImage = getImage(thumbnail); | ||
return ( | ||
<p key={youTubeId}> | ||
<a href={oEmbed.url}> | ||
<GatsbyImage | ||
aspectRatio={16 / 9} | ||
image={gatsbyImage} | ||
alt={oEmbed.title} | ||
/> | ||
</a> | ||
</p> | ||
); | ||
})} | ||
</div> | ||
</header> | ||
</main> | ||
); | ||
}; | ||
|
||
export const query = graphql` | ||
{ | ||
allYouTube { | ||
nodes { | ||
youTubeId | ||
oEmbed { | ||
title | ||
url | ||
} | ||
thumbnail { | ||
childImageSharp { | ||
gatsbyImageData( | ||
width: 480 | ||
transformOptions: { fit: COVER, cropFocus: CENTER } | ||
aspectRatio: 1.77777778 | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export default IndexPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.