Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

hotfix/fix-image-error #412

Merged
merged 7 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions components/molecules/ImageGallery/ImageGallery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from '@/components/atoms/Image'
import DisplayImage from '@/components/atoms/Image'
import RichText from '@/components/atoms/RichText'
import cn from 'classnames'
import PropTypes from 'prop-types'
Expand Down Expand Up @@ -31,11 +31,13 @@ export default function ImageGallery({
<div className={cn(styles.wrap, styles[`columns-${columns}`])}>
{images.map((image, index) => {
return (
<Image
<DisplayImage
className={styles.imageWrap}
key={index}
url={image.url}
alt={image.alt}
id={image.id}
imageMeta={{mediaItemUrl: image.url, altText: image.alt}}
nextImageFill={true}
/>
)
})}
Expand Down
12 changes: 11 additions & 1 deletion components/molecules/ImageGallery/ImageGallery.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}

&.columns-3 {
@apply grid-cols-4;
@apply grid-cols-3;
}

&.columns-4 {
Expand All @@ -37,6 +37,16 @@
& > div {
@apply self-center;
}

& .imageWrap {
@apply relative h-0 w-full;

padding-top: 67.58%; /* Aspect ratio box - https://css-tricks.com/aspect-ratio-boxes */
}

& img {
@apply absolute top-0 left-0 w-full h-full object-cover;
}
}

& .caption {
Expand Down
11 changes: 7 additions & 4 deletions components/organisms/MediaText/MediaText.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from '@/components/atoms/Button'
import Image from '@/components/atoms/Image'
import DisplayImage from '@/components/atoms/Image'
import cn from 'classnames'
import PropTypes from 'prop-types'
import React, {useEffect} from 'react'
Expand Down Expand Up @@ -65,9 +65,12 @@ export default function MediaText({
</div>
<div className={styles.media}>
{image && image.url && (
<div className={styles.imageWrap}>
<Image url={image.url} alt={image.alt} />
</div>
<DisplayImage
className={styles.imageWrap}
alt={image.alt}
imageMeta={{mediaItemUrl: image.url, altText: image.alt}}
nextImageFill={true}
/>
)}
</div>
</section>
Expand Down