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

Commit

Permalink
Merge pull request #412 from WebDevStudios/hotfix/fix-image-error
Browse files Browse the repository at this point in the history
hotfix/fix-image-error
  • Loading branch information
Greg Rickaby authored Jun 1, 2021
2 parents 8b9690e + 2090538 commit 296d829
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
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

1 comment on commit 296d829

@vercel
Copy link

@vercel vercel bot commented on 296d829 Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.