Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tracedsvg feature to using contentful #5859

Merged
Merged
Changes from all commits
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
40 changes: 40 additions & 0 deletions examples/using-contentful/src/pages/image-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,43 @@ const ImageAPI = props => {
}
}
}
}`,
}}
/>
</pre>
<h2>Traced SVG previews</h2>
<p>
You can show a traced SVG preview to your users. This works equivalent
to the responsive sizes feature except that you have to use the
GatsbyContentfulSizes_tracedSVG fragment
</p>
{assets.map(({ node: { title, traced } }) => (
<Img
key={traced.src}
alt={title}
sizes={traced}
style={{
marginRight: rhythm(1 / 2),
marginBottom: rhythm(1 / 2),
border: `1px solid tomato`,
}}
/>
))}
<h4>GraphQL query</h4>
<pre style={{ background: `#efeded`, padding: rhythm(3 / 4) }}>
<code
dangerouslySetInnerHTML={{
__html: `{
allContentfulAsset {
edges {
node {
title
sizes(maxWidth: 614) {
...GatsbyContentfulSizes_tracedSVG
}
}
}
}
}`,
}}
/>
Expand Down Expand Up @@ -292,6 +329,9 @@ export const pageQuery = graphql`
fluid(maxWidth: 613) {
...GatsbyContentfulFluid_noBase64
}
traced: sizes(maxWidth: 614) {
...GatsbyContentfulSizes_tracedSVG
}
}
}
}
Expand Down