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

33 lines
708 B
React
Raw Normal View History

2018-07-17 23:33:55 +02:00
import React from 'react'
import PropTypes from 'prop-types'
import { graphql } from 'gatsby'
import Img from 'gatsby-image'
import styles from './Image.module.scss'
2018-08-31 00:15:42 +02:00
const Image = ({ fluid, fixed, alt }) => (
2018-07-17 23:33:55 +02:00
<Img
className={styles.image}
outerWrapperClassName={styles.imageWrap}
2018-09-12 21:03:35 +02:00
backgroundColor="#dfe8ef"
2018-08-31 00:15:42 +02:00
fluid={fluid ? fluid : null}
fixed={fixed ? fixed : null}
alt={alt}
2018-07-17 23:33:55 +02:00
/>
)
Image.propTypes = {
2018-08-31 00:15:42 +02:00
fluid: PropTypes.object,
fixed: PropTypes.object,
2018-07-17 23:33:55 +02:00
alt: PropTypes.string
}
export const projectImage = graphql`
fragment ImageFluid on ImageSharp {
fluid(maxWidth: 940, quality: 85) {
2018-09-06 22:28:28 +02:00
...GatsbyImageSharpFluid_withWebp_noBase64
2018-07-17 23:33:55 +02:00
}
}
`
export default Image