-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathGallery.js
More file actions
106 lines (99 loc) · 2.32 KB
/
Gallery.js
File metadata and controls
106 lines (99 loc) · 2.32 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import React from 'react';
import styled from 'styled-components';
import { StaticQuery, graphql } from 'gatsby';
import Img from 'gatsby-image';
import { Section, Container } from '@components/global';
import ExternalLink from '@common/ExternalLink';
const GALLERY = [
{
name: 'Yoda',
image: 'yoda.jpeg',
url: 'https://twitter.com/yodaism',
},
{
name: 'r2d2',
image: 'r2d2.jpeg',
url: 'https://twitter.com/dan_abramov',
},
{
name: 'Darth Vader',
image: 'darthvader.jpeg',
url: 'https://twitter.com/darthvader',
},
{
name: 'Stormtrooper',
image: 'stormtrooper.jpeg',
url: 'https://twitter.com/dan_abramov',
},
{
name: 'r2d2',
image: 'r2d2.jpeg',
url: 'https://twitter.com/dan_abramov',
},
{
name: 'Yoda',
image: 'yoda.jpeg',
url: 'https://twitter.com/yodaism',
},
{
name: 'Stormtrooper',
image: 'stormtrooper.jpeg',
url: 'https://twitter.com/dan_abramov',
},
{
name: 'Darth Vader',
image: 'darthvader.jpeg',
url: 'https://twitter.com/darthvader',
},
];
const Gallery = () => (
<StaticQuery
query={graphql`
query {
allFile(filter: { sourceInstanceName: { eq: "gallery" } }) {
edges {
node {
relativePath
childImageSharp {
fluid(maxWidth: 200, maxHeight: 200) {
...GatsbyImageSharpFluid
}
}
}
}
}
}
`}
render={data => (
<Section id="gallery">
<Container>
<h1 style={{ marginBottom: '3rem' }}>Gallery</h1>
<Grid>
{GALLERY.map(({ name, image, url }, i) => {
const img = data.allFile.edges.find(
({ node }) => node.relativePath === image
).node;
return (
<ExternalLink href={url} key={i}>
<Img fluid={img.childImageSharp.fluid} alt={name} />
<p>{name}</p>
</ExternalLink>
);
})}
</Grid>
</Container>
</Section>
)}
/>
);
const Grid = styled.div`
display: grid;
grid-template-columns: repeat(auto-fill, 200px);
grid-gap: 24px;
justify-content: center;
> a {
text-decoration: none;
color: inherit;
}
`;
export default Gallery;