Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Traced/primitive svg previews #8

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
first working version
  • Loading branch information
Benedikt Rötsch committed Feb 23, 2018
commit bf9238f6212d06900f0a9e285cd37a43b1265a0e
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
pathPrefix: '/gatsby-contentful-starter',
plugins: [
'gatsby-transformer-remark',
'gatsby-transformer-sqip',
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-source-contentful',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"dependencies": {
"contentful-import": "^6.2.0",
"gatsby-image": "^1.0.39",
"gatsby-link": "^1.6.34",
"gatsby-plugin-react-helmet": "^1.0.8",
"gatsby-source-contentful": "^1.3.38",
Expand Down
10 changes: 9 additions & 1 deletion src/components/article-preview.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import React from 'react'
import styles from './article-preview.module.css'
import Link from 'gatsby-link'
import Img from 'gatsby-image'

export default ({ article }) => (
<div className={styles.preview}>
<img src={`${article.heroImage.file.url}?fit=scale&w=350&h=196`} alt="" />
<Img
className={styles.heroImage}
resolutions={{
...article.heroImage.resolutions,
base64: article.heroImage.sqip
}}
alt=""
/>
<h3 className={styles.previewTitle}>
<Link to={`/blog/${article.slug}`}>{article.title}</Link>
</h3>
Expand Down
8 changes: 6 additions & 2 deletions src/components/hero.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import React from 'react'
import Img from "gatsby-image";
import styles from './hero.module.css'

export default ({ person }) => (
<div className={styles.hero}>
<img
<Img
className={styles.heroImage}
src={`${person.node.image.file.url}?w=1180&h=600&fit=pad&bg=rgb:000000`}
resolutions={{
...person.node.image.resolutions,
base64: person.node.image.sqip
}}
alt=""
/>
<div className={styles.heroDetails}>
Expand Down
10 changes: 9 additions & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export const pageQuery = graphql`
heroImage {
file {
url
}
},
resolutions {
...GatsbyContentfulResolutions_withWebp_noBase64
},
sqip(numberOfPrimitives: 25, blur: 0)
}
description {
childMarkdownRemark {
Expand All @@ -69,6 +73,10 @@ export const pageQuery = graphql`
url
fileName
contentType
},
sqip(numberOfPrimitives: 50, blur: 1),
resolutions {
...GatsbyContentfulResolutions_withWebp_noBase64
}
}
}
Expand Down