-
Notifications
You must be signed in to change notification settings - Fork 10.3k
/
remote-file.js
73 lines (68 loc) · 1.68 KB
/
remote-file.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { graphql } from "gatsby"
import React from "react"
import { GatsbyImage } from "gatsby-plugin-image"
import Layout from "../components/layout"
import SEO from "../components/seo"
const RemoteFile = ({ data }) => {
return (
<Layout>
<SEO title="Remote file" />
{data.allMyRemoteFile.nodes.map(node => {
return (
<div key={node.id}>
<h2>
<a href={node.publicUrl} data-testid="public">
{node.filename}
</a>
</h2>
<img
src={node.resize.src}
width={node.resize.width}
height={node.resize.height}
alt=""
className="resize"
/>
<div>
<GatsbyImage className="fixed" image={node.fixed} alt="" />
<GatsbyImage
className="constrained"
image={node.constrained}
alt=""
/>
<GatsbyImage className="full" image={node.full} alt="" />
</div>
</div>
)
})}
</Layout>
)
}
export const pageQuery = graphql`
{
allMyRemoteFile {
nodes {
id
url
filename
publicUrl
resize(width: 100) {
height
width
src
}
fixed: gatsbyImageData(
layout: FIXED
width: 100
placeholder: DOMINANT_COLOR
)
constrained: gatsbyImageData(
layout: CONSTRAINED
width: 300
placeholder: BLURRED
)
full: gatsbyImageData(layout: FULL_WIDTH, width: 500, placeholder: NONE)
}
}
}
`
export default RemoteFile