-
Notifications
You must be signed in to change notification settings - Fork 0
/
bgImage.js
40 lines (39 loc) · 1.04 KB
/
bgImage.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
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import styled from "styled-components"
import { GatsbyImage } from "gatsby-plugin-image"
const BackgroundImage = styled(GatsbyImage)`
height: 65vh;
width: 100%;
background-size: cover;
background-position: top center;
background-attachment: fixed;
`
export default function Hero() {
const imagedata = useStaticQuery(graphql`
query BackgroundImageQuery {
file(relativePath: { eq: "Stonehenge.jpg" }) {
childImageSharp {
gatsbyImageData(
layout: FULL_WIDTH
quality: 80
backgroundColor: "black"
jpgOptions: {quality: 80}
transformOptions: {duotone: {
highlight: "#ffffff"
shadow: "#222222"
opacity: 80
}}
)
}
}
}
`)
return(
<BackgroundImage
className="background-image"
image={imagedata.file.childImageSharp.gatsbyImageData}
alt={'Stonehenge seen from the Heel stone'}
/>
)
}