2020-05-22 14:38:19 +02:00
|
|
|
import React, { ReactElement } from 'react'
|
2019-10-02 13:35:50 +02:00
|
|
|
import { graphql } from 'gatsby'
|
2021-03-06 02:58:10 +01:00
|
|
|
import { GatsbyImage } from 'gatsby-plugin-image'
|
2019-10-28 23:00:55 +01:00
|
|
|
import { ImageProps } from '../../@types/Image'
|
2021-03-13 04:11:44 +01:00
|
|
|
import { image as styleImage, imageTitle } from './Image.module.css'
|
2019-10-02 13:35:50 +02:00
|
|
|
|
2020-05-22 14:38:19 +02:00
|
|
|
export const Image = ({
|
|
|
|
title,
|
2021-03-06 02:58:10 +01:00
|
|
|
image,
|
2020-05-22 14:38:19 +02:00
|
|
|
alt,
|
2021-03-04 01:20:39 +01:00
|
|
|
original,
|
|
|
|
className
|
2020-05-22 14:38:19 +02:00
|
|
|
}: ImageProps): ReactElement => (
|
2021-03-04 01:20:39 +01:00
|
|
|
<figure
|
2021-03-13 04:11:44 +01:00
|
|
|
className={`${styleImage} ${className ? className : ''}`}
|
|
|
|
data-original={original?.src}
|
2021-03-04 01:20:39 +01:00
|
|
|
>
|
2021-03-13 04:11:44 +01:00
|
|
|
<GatsbyImage backgroundColor="transparent" image={image} alt={alt} />
|
|
|
|
{title && <figcaption className={imageTitle}>{title}</figcaption>}
|
2019-11-08 18:06:56 +01:00
|
|
|
</figure>
|
2019-10-28 23:00:55 +01:00
|
|
|
)
|
2019-10-02 13:35:50 +02:00
|
|
|
|
|
|
|
export const imageSizeDefault = graphql`
|
|
|
|
fragment ImageFluid on ImageSharp {
|
2019-10-28 23:00:55 +01:00
|
|
|
original {
|
|
|
|
src
|
|
|
|
}
|
2021-03-21 22:49:39 +01:00
|
|
|
gatsbyImageData(layout: CONSTRAINED, width: 1040, quality: 85)
|
2019-10-02 13:35:50 +02:00
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
export const imageSizeThumb = graphql`
|
|
|
|
fragment ImageFluidThumb on ImageSharp {
|
2019-10-28 23:00:55 +01:00
|
|
|
original {
|
|
|
|
src
|
|
|
|
}
|
2021-03-21 22:49:39 +01:00
|
|
|
gatsbyImageData(layout: CONSTRAINED, width: 480, height: 140, quality: 85)
|
2020-07-19 13:31:27 +02:00
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
export const photoSizeThumb = graphql`
|
|
|
|
fragment PhotoFluidThumb on ImageSharp {
|
|
|
|
original {
|
|
|
|
src
|
|
|
|
}
|
2021-03-21 22:49:39 +01:00
|
|
|
gatsbyImageData(
|
|
|
|
layout: CONSTRAINED
|
|
|
|
width: 316
|
|
|
|
height: 316
|
|
|
|
quality: 85
|
|
|
|
transformOptions: { cropFocus: CENTER }
|
|
|
|
)
|
2019-10-02 13:35:50 +02:00
|
|
|
}
|
|
|
|
`
|