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

Commit

Permalink
Merge pull request #564 from brandonbk/adjust-node
Browse files Browse the repository at this point in the history
Collapse image container if none present
brandonbk authored Feb 11, 2023
2 parents 8e35629 + 641d905 commit bb9a60c
Showing 1 changed file with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -89,28 +89,26 @@ $ const blockName = "section-feed-content-node";
</marko-web-content-sponsors>
</marko-web-element>
</marko-web-element>
<if(displayImage)>
<if(displayImage && primaryImage.src)>
<marko-web-element block-name=blockName name="image-wrapper">
<if(primaryImage.src)>
$ const src = buildImgixUrl(primaryImage.src, imageOptions, null, get(primaryImage, 'isLogo'));
$ const srcset = [src, `${buildImgixUrl(src, { dpr: 2 })} 2x`];
$ const src = buildImgixUrl(primaryImage.src, imageOptions, null, get(primaryImage, 'isLogo'));
$ const srcset = [src, `${buildImgixUrl(src, { dpr: 2 })} 2x`];

$ const srcMobile = buildImgixUrl(primaryImage.src, mobileImageOptions, null, get(primaryImage, 'isLogo'));
$ const srcsetMobile = [srcMobile, `${buildImgixUrl(srcMobile, { dpr: 2 })} 2x`];
$ const srcMobile = buildImgixUrl(primaryImage.src, mobileImageOptions, null, get(primaryImage, 'isLogo'));
$ const srcsetMobile = [srcMobile, `${buildImgixUrl(srcMobile, { dpr: 2 })} 2x`];

<marko-web-picture>
<@link href=get(content, "siteContext.path") attrs=linkAttrs />
<@source srcset=srcset media="(min-width: 768px)" width=250 height=167 />
<@image
src=srcMobile
srcset=srcsetMobile
class=[`${blockName}__image`]
alt=primaryImage.alt
lazyload=lazyload
attrs={ width: "112", height: "112" }
/>
</marko-web-picture>
</if>
<marko-web-picture>
<@link href=get(content, "siteContext.path") attrs=linkAttrs />
<@source srcset=srcset media="(min-width: 768px)" width=250 height=167 />
<@image
src=srcMobile
srcset=srcsetMobile
class=[`${blockName}__image`]
alt=primaryImage.alt
lazyload=lazyload
attrs={ width: "112", height: "112" }
/>
</marko-web-picture>
</marko-web-element>
</if>
</marko-web-block>

0 comments on commit bb9a60c

Please sign in to comment.