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 #953 from B77Mills/sectionFeedNode
Browse files Browse the repository at this point in the history
SCSS & Marko section feed  mobile card & 16:9 image ratio support within section feeds
  • Loading branch information
brandonbk authored Aug 27, 2024
2 parents a045eda + afeb7ac commit 60352e2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ $ const blockName = "section-feed-content-node";
$ const link = linkField && get(content, linkField) ? get(content, linkField) : get(content, "siteContext.path");
<marko-web-picture>
<@link href=link target=linkTarget attrs=linkAttrs />
<@source srcset=srcset media="(min-width: 768px)" width=250 height=167 />
<@source srcset=srcset media="(min-width: 768px)" width=imageOptions.w height=imageOptions.h />
<@image
src=srcMobile
srcset=srcsetMobile
class=[`${blockName}__image`]
alt=primaryImage.alt
lazyload=lazyload
attrs={ width: "112", height: "112" }
attrs={ width: mobileImageOptions.w, height: mobileImageOptions.h }
/>
</marko-web-picture>
</marko-web-element>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
.section-feed-content-node {
$self: &;

$image-size: 112px;
@function ab($a, $b: null) {
@if $b != null {
@return $b;
}
@return $a;
}

$image-size: 112px ;
$image-mobile-width: null !default;
$image-mobile-height: null !default;
$image-width: ab($image-size, $image-mobile-width);
$image-height: ab($image-size, $image-mobile-height);

$image-desktop-width: 250px;
$image-desktop-height: 167px;


display: flex;
width: 100%;

Expand All @@ -30,9 +43,9 @@
}

&__image-wrapper {
width: $image-size;
min-width: $image-size;
height: $image-size;
width: $image-width;
min-width: $image-width;
height: $image-height;
margin-left: 15px;
@include media-breakpoint-up(md) {
width: $image-desktop-width;
Expand All @@ -44,8 +57,8 @@
}

&__image {
width: $image-size;
height: $image-size;
width: $image-width;
height: $image-height;
object-fit: cover;
object-position: left;
border: 1px solid rgba(239, 239, 239, .9);
Expand Down Expand Up @@ -219,4 +232,22 @@
}
}
}
//@todo this should also be dependend on the image width/height differing from 112
@include media-breakpoint-down(sm) {
&--section-feed-mobile-cards {
.section-feed-content-node {
&:first-child {
border-top: none;
}
flex-direction: column-reverse;
.section-feed-content-node__image-wrapper {
margin-left: 0;
margin-bottom: map-get($spacers, block);
}
.section-feed-content-node__content-teaser {
display: initial;
}
}
}
}
}

0 comments on commit 60352e2

Please sign in to comment.