Skip to content

Commit 1b860ac

Browse files
committed
Merge branch 'contentful-mobile' into feature-contentful
2 parents 744de10 + 24365e6 commit 1b860ac

File tree

1 file changed

+3
-1
lines changed
  • src/shared/components/Contentful/Image

1 file changed

+3
-1
lines changed

src/shared/components/Contentful/Image/index.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import LoadingIndicator from 'components/LoadingIndicator';
77
import PT from 'prop-types';
88
import React from 'react';
99
import _ from 'lodash';
10+
import { useMediaQuery } from 'react-responsive';
1011

1112
import Image from './Image';
1213
import defaultTheme from './themes/default.scss';
@@ -17,6 +18,7 @@ export default function ImageLoader(props) {
1718
const {
1819
id, preview, spaceName, environment,
1920
} = props;
21+
const isTabletOrMobile = useMediaQuery({ maxWidth: 768 });
2022
return (
2123
<ContentfulLoader
2224
entryIds={id}
@@ -25,7 +27,7 @@ export default function ImageLoader(props) {
2527
environment={environment}
2628
render={(data) => {
2729
const { fields } = data.entries.items[id];
28-
const imgId = _.get(fields, 'source.sys.id');
30+
const imgId = _.get(fields, isTabletOrMobile && fields.sourceMobile ? 'sourceMobile.sys.id' : 'source.sys.id');
2931
const clipSvgId = _.get(fields, 'clipSvg.sys.id');
3032
const assetIds = _.compact([imgId, clipSvgId]);
3133
const animationId = _.get(fields, 'animationOnScroll.sys.id');

0 commit comments

Comments
 (0)