1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-14 21:10:25 +01:00
blog/src/components/atoms/Image.jsx
2018-09-12 21:50:42 +02:00

33 lines
708 B
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import { graphql } from 'gatsby'
import Img from 'gatsby-image'
import styles from './Image.module.scss'
const Image = ({ fluid, fixed, alt }) => (
<Img
className={styles.image}
outerWrapperClassName={styles.imageWrap}
backgroundColor="#dfe8ef"
fluid={fluid ? fluid : null}
fixed={fixed ? fixed : null}
alt={alt}
/>
)
Image.propTypes = {
fluid: PropTypes.object,
fixed: PropTypes.object,
alt: PropTypes.string
}
export const projectImage = graphql`
fragment ImageFluid on ImageSharp {
fluid(maxWidth: 940, quality: 85) {
...GatsbyImageSharpFluid_withWebp_noBase64
}
}
`
export default Image