Skip to content

Commit bd4d059

Browse files
committed
Updated home page image dimensions.
1 parent 92ce912 commit bd4d059

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/app/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const HomePage = async () => {
2020
<Fragment>
2121
<ImageGallery
2222
className="mb-4"
23+
maxHeight="400px"
2324
images={homePage?.data?.attributes?.imageGallery.images}
2425
/>
2526
<TextCard

src/components/cms/common/imageGallery/ImageGallery.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { StrapiImage } from '@components/cms/utils/strapiImage';
88

99
interface Props {
1010
className?: string
11+
maxHeight?: string
1112
images?: Maybe<{
1213
data: {
1314
attributes: Maybe<{
@@ -20,7 +21,7 @@ interface Props {
2021
}>
2122
}
2223

23-
export const ImageGallery: React.FC<Props> = ({ className, images }) => {
24+
export const ImageGallery: React.FC<Props> = ({ className, maxHeight, images }) => {
2425
if (!images || !images.data.length) {
2526
return null;
2627
}
@@ -48,8 +49,9 @@ export const ImageGallery: React.FC<Props> = ({ className, images }) => {
4849
images.data.map((image, idx) => image && (
4950
<div key={idx} className="w-100">
5051
<StrapiImage
51-
className="w-100 h-100 object-fit-cover"
52+
className="w-100 h-100 object-fit-contain"
5253
loading={idx === 0 ? 'eager' : 'lazy'}
54+
style={{ maxHeight }}
5355
{...image.attributes}
5456
/>
5557
</div>

src/components/cms/common/textImageColumn/TextImageColumn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const TextImageColumn: React.FC<Props> = ({ className, id, text, image, f
3737
<div className="w-100 d-flex align-items-center justify-content-center">
3838
{
3939
image && (
40-
<StrapiImage className="w-100 object-fit-cover" {...image.data?.attributes} />
40+
<StrapiImage className="w-100 h-auto object-fit-contain" {...image.data?.attributes} />
4141
)
4242
}
4343
</div>

src/components/cms/utils/strapiImage/StrapiImage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { getStrapiMedia } from '@lib/services/strapi/utils/media';
55

66
interface Props {
77
className?: string
8+
style?: React.CSSProperties
89
loading?: 'eager' | 'lazy'
910

1011
url?: string
@@ -13,7 +14,7 @@ interface Props {
1314
height?: Maybe<number>
1415
}
1516

16-
export const StrapiImage: React.FC<Props> = ({ className, loading, url, alternativeText, width, height }) => {
17+
export const StrapiImage: React.FC<Props> = ({ className, style, loading, url, alternativeText, width, height }) => {
1718
const imageUrl = getStrapiMedia(url);
1819
const altText = alternativeText || 'image';
1920

@@ -27,6 +28,7 @@ export const StrapiImage: React.FC<Props> = ({ className, loading, url, alternat
2728
return (
2829
<Image
2930
className={className}
31+
style={style}
3032
loading={loading}
3133
src={imageUrl}
3234
alt={altText}

0 commit comments

Comments
 (0)