portfolio/src/components/atoms/ProjectImage.jsx

42 lines
1.1 KiB
React
Raw Permalink Normal View History

2021-03-13 01:03:23 +01:00
import React from 'react'
2018-04-21 20:01:50 +02:00
import PropTypes from 'prop-types'
2018-06-21 21:06:53 +02:00
import { graphql } from 'gatsby'
2021-03-13 01:03:23 +01:00
import { GatsbyImage } from 'gatsby-plugin-image'
2021-03-12 23:47:28 +01:00
import { projectImage as styleProjectImage } from './ProjectImage.module.css'
2018-04-20 19:59:27 +02:00
2021-03-13 15:48:58 +01:00
export default function ProjectImage({ image, alt, className }) {
2021-03-13 01:03:23 +01:00
return (
<GatsbyImage
2021-03-13 15:48:58 +01:00
className={`${styleProjectImage} ${className || ''}`}
2021-03-13 01:03:23 +01:00
backgroundColor="transparent"
image={image}
alt={alt}
2021-03-13 15:48:58 +01:00
as="figure"
2021-03-13 01:03:23 +01:00
/>
)
}
2018-04-21 20:01:50 +02:00
2021-03-13 01:03:23 +01:00
ProjectImage.propTypes = {
image: PropTypes.object.isRequired,
2021-03-13 15:48:58 +01:00
alt: PropTypes.string.isRequired,
className: PropTypes.string
2018-04-21 20:01:50 +02:00
}
2018-04-20 19:59:27 +02:00
2018-05-04 14:00:21 +02:00
export const projectImage = graphql`
2018-06-19 22:48:33 +02:00
fragment ProjectImageFluid on ImageSharp {
2021-03-13 01:03:23 +01:00
gatsbyImageData(layout: CONSTRAINED, width: 1440, quality: 85)
2018-05-04 14:00:21 +02:00
}
`
2021-03-13 13:57:05 +01:00
export const projectImageTeaser = graphql`
fragment ProjectImageTeaser on ImageSharp {
2021-03-13 15:48:58 +01:00
gatsbyImageData(layout: CONSTRAINED, width: 740, quality: 85)
2021-03-13 13:57:05 +01:00
}
`
2021-03-13 17:42:21 +01:00
export const projectImageNav = graphql`
fragment ProjectImageNav on ImageSharp {
gatsbyImageData(layout: CONSTRAINED, width: 500, quality: 85)
}
`