diff --git a/source/_patterns/04-components/card/card--node/card--node.twig b/source/_patterns/04-components/card/card--node/card--node.twig index 361e2c040299f54a852437f65d648e01ce61d21b..384e351a9421bb04723b8a161f3acadfaa668b31 100644 --- a/source/_patterns/04-components/card/card--node/card--node.twig +++ b/source/_patterns/04-components/card/card--node/card--node.twig @@ -21,4 +21,5 @@ 'additional_info': node.additional_info, 'contact_for': node.contact_for, 'groups': node.groups, + 'featured_image': 'yes', } %} diff --git a/source/_patterns/04-components/card/card.twig b/source/_patterns/04-components/card/card.twig index 08472783f1a5eda651980e2f46b21d5cf8eac2d0..beb9606173b84f9cd4afcbaeb55f30282e68516c 100644 --- a/source/_patterns/04-components/card/card.twig +++ b/source/_patterns/04-components/card/card.twig @@ -1,6 +1,12 @@ {% import '@base/macros/uw.macro.twig' as macros %} <article class="card {{ modifier_classes }} {% if show_hover %} card--show-hover {% endif %} {{ type }}" > + + {% if featured_image and img_element %} + <div class="card__featured-image" style="background-image: url({{ img_element }});" role="img" aria-label="{{ alt }}"> + </div> + {% endif %} + <div class="card__body"> {% if title or author or date or sub_title %} <div class="card__header"> @@ -41,7 +47,7 @@ {% endif %} </div> {% endif %} - {% if sources or img_element %} + {% if not featured_image and (sources or img_element) %} <div class="card__media"> {% if url %} <a href="{{ url }}">