From 81a210e63517466e0dd54a0b9f6ae93c17a5e4f4 Mon Sep 17 00:00:00 2001
From: Igor Biki <ibiki@uwaterloo.ca>
Date: Thu, 24 Jun 2021 14:15:36 -0400
Subject: [PATCH] ISTWCMS-4909 Update to card, adding hero image.

---
 .../_patterns/04-components/card/card--node/card--node.twig   | 1 +
 source/_patterns/04-components/card/card.twig                 | 4 ++--
 source/_patterns/04-components/card/card.yml                  | 3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

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 261ccb5d..53f43d8e 100644
--- a/source/_patterns/04-components/card/card--node/card--node.twig
+++ b/source/_patterns/04-components/card/card--node/card--node.twig
@@ -29,5 +29,6 @@
     'groups': node.groups,
     'featured_image': featured_image,
     'card_type': 'node',
+    'hero': node.hero,
   } %}
 </div>
diff --git a/source/_patterns/04-components/card/card.twig b/source/_patterns/04-components/card/card.twig
index 0e6616ce..c410e4a0 100644
--- a/source/_patterns/04-components/card/card.twig
+++ b/source/_patterns/04-components/card/card.twig
@@ -9,8 +9,8 @@
 
 <article class="card {{ modifier_classes }} {% if show_hover %} card--show-hover {% endif %} {{ card_type }}" >
 
-  {% if featured_image == 'yes' and img_element %}
-    <div class="card__featured-image" style="background-image: url({{ img_element }});" role="img" aria-label="{{ alt }}">
+  {% if featured_image == 'yes' and hero.img_element %}
+    <div class="card__featured-image" style="background-image: url({{ hero.img_element }});" role="img" aria-label="{{ hero.alt }}">
     </div>
   {%  endif %}
 
diff --git a/source/_patterns/04-components/card/card.yml b/source/_patterns/04-components/card/card.yml
index db027095..4839c8b4 100644
--- a/source/_patterns/04-components/card/card.yml
+++ b/source/_patterns/04-components/card/card.yml
@@ -73,3 +73,6 @@ social_media:
     - text: 'LinkedIn'
       url: 'https://www.linkedin.com/edu/school?id=10875'
 social_media_placement: 'card-footer'
+hero:
+  img_element: '../../../../source/images/president/president_xlarge.jpg'
+  alt: 'Alternative hero text'
-- 
GitLab