Created
December 7, 2018 12:59
-
-
Save trickydisco78/4283d721ec4f3b18607c74d75376a79d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
import Img from 'gatsby-image' | |
import { renameProp, renameKeys } from '../../utils/renameprop' | |
import HeroText from './heroText' | |
import './hero.css' | |
interface IHeroProps { | |
heroImg?: object | |
} | |
const Hero: React.SFC<IHeroProps> = ({ | |
heroImg, | |
heroText, | |
addText, | |
heroTextPos, | |
heroLink | |
}) => { | |
const webPsrc = renameKeys(heroImg.webp, { | |
srcSet: 'srcSetWebp', | |
src: 'srcWebP' | |
}) | |
const heroFluid = { ...heroImg.png, ...webPsrc } | |
return ( | |
<section> | |
{addText ? <a href="#" className="hero-link"> : null} | |
<div className={`hero ${addText ? '${heroTextPos}' : null}`}> | |
<Img | |
fluid={heroFluid} | |
style={{ | |
position: 'absolute', | |
width: '100%', | |
height: '100%', | |
left: 0 | |
}} | |
/> | |
{addText ? ( | |
<HeroText heroText={heroText} /> | |
) : null} | |
{addText ? </a> : null} | |
</div> | |
</section> | |
) | |
} | |
export default Hero |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment