text: import React from "react"
  import styled from "styled-components"
  import { graphql, useStaticQuery, Link } from "gatsby"
  import Img from "gatsby-image"
  
  import { Container } from "../global"
  
  const Hero = ({ className }) => {
    const { 
      hero: { image, title, subtitle }
    } = useStaticQuery(getHero)
    
  
    const handleSubmit = event => {
      event.preventDefault()
    }
  
    return (
      <HeaderWrapper id="top">
        <Container>
          <Flex>
            <HeaderTextGroup>
              <Subtitle>New Episode!</Subtitle>
              <h1>{title}</h1>
              <p>{subtitle}</p>
                  
            </HeaderTextGroup>
            <ImageWrapper>
              <StyledImage  fixed={image.fixed} alt={`Hero Image`} />
              <br />
            </ImageWrapper>
          </Flex>
        </Container>
      </HeaderWrapper>
    )
  }
  
  
  // query
  const getHero = graphql`
    {
      hero: contentfulHero {
        image {
          fixed (width:542) {
            ...GatsbyContentfulFixed
          }
        }
        title
        subtitle
      }
    }
  `
  
  export default Hero
  
  const HeaderWrapper = styled.header`
    background-color: #f8f8f8;
    padding: 160px 0 80px 0;
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 calc(100% - 5vw));
    @media (max-width: ${props => props.theme.screen.md}) {
    }
  `
  const Subtitle = styled.h5`
    font-size: 16px;
    color: ${props => props.theme.color.accent};
    letter-spacing: 0px;
    margin-bottom: 16px;
  `
  
  const HeaderTextGroup = styled.div`
    margin: 0;
    > div {
      width: 120%;
      margin-bottom: -4.5%;
      @media (max-width: ${props => props.theme.screen.md}) {
        margin: 0 16px;
      }
    }
    h1 {
      margin: 0 0 24px;
      color: ${props => props.theme.color.primary};
    }
    h2 {
      margin-bottom: 24px;
      ${props => props.theme.font_size.regular}
    }
    p {
      margin-bottom: 48px;
    }
  `
  
  const Flex = styled.div`
    display: grid;
    justify-content: space-between;
    align-content: center;
    grid-template-columns: 1fr 1fr;
    @media (max-width: ${props => props.theme.screen.md}) {
      grid-template-columns: 1fr;
      grid-gap: 64px;
    }
  `
  
  
  const HeaderButton = styled.button`
    font-weight: 500;
    font-size: 14px;
    color: white;
    letter-spacing: 1px;
    height: 60px;
    display: block;
    margin-left: 8px;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    background: ${props => props.theme.color.secondary};
    border-radius: 4px;
    padding: 0px 40px;
    border-width: 0px;
    border-style: initial;
    border-color: initial;
    border-image: initial;
    outline: 0px;
    &:hover {
      box-shadow: rgba(110, 120, 152, 0.22) 0px 2px 10px 0px;
    }
    @media (max-width: ${props => props.theme.screen.md}) {
    }
    @media (max-width: ${props => props.theme.screen.sm}) {
      margin-left: 0;
    }
  `
  const ImageWrapper = styled.div`
    justify-self: end;
    align-self: center;
    @media (max-width: ${props => props.theme.screen.md}) {
      justify-self: center;
    }
  `
  
  const StyledImage = styled(Img)`
    width: 500px;
    @media (max-width: ${props => props.theme.screen.md}) {
      width: 400px;
    }
    @media (max-width: ${props => props.theme.screen.sm}) {
      width: 300px;
      display: none;
    }
  `