Last active
September 28, 2019 11:04
-
-
Save iamskok/9aceca8ae19974c4422f9b685847042b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** @jsx jsx */ | |
import { jsx } from 'theme-ui' | |
import { useEffect, useState } from 'react' | |
import Image from 'gatsby-image' | |
import { getFluidImageObject } from 'gatsby-transformer-cloudinary' | |
export default () => { | |
const [fluid, setFluid] = useState(false) | |
useEffect(() => { | |
getFluidImageObject({ | |
public_id: 'gatsby-cloudinary/simpson', | |
cloudName: 'iamskok', | |
originalHeight: 264, | |
originalWidth: 382, | |
transformations: ['t_gif-to-mp4-transform'], | |
}) | |
.then(result => setFluid(result)) | |
}, []) | |
return ( | |
fluid ? | |
<Image | |
fluid={ fluid } | |
sx={{ | |
maxWidth: 382, | |
maxHeight: 264, | |
}} | |
alt="What should be simple is actually pretty painful" | |
/> : | |
<div | |
sx={{ | |
height: '100vh', | |
width: '100vw', | |
maxWidth: 382, | |
maxHeight: 264, | |
}} | |
/> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment