From 1da0d5021f882f0afa621cd665eac0df3e4810fd Mon Sep 17 00:00:00 2001 From: Aline Date: Wed, 29 Nov 2023 14:45:25 +0100 Subject: [PATCH] Create component variants Use variants for fullwidth teaser and headlines with image legend. --- .../fullwidth-teaser-horizontal.twig | 4 ++ .../fullwidth-teaser-legend.twig | 38 ++++++++++++++++ .../fullwidth-teaser/fullwidth-teaser.twig | 7 +-- .../fullwidth-teaser/fullwidth-teaser.yml | 6 +++ .../organisms/headlines/headlines-legend.twig | 44 +++++++++++++++++++ .../organisms/headlines/headlines.yml | 3 ++ 6 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 assets/components/organisms/fullwidth-teaser/fullwidth-teaser-legend.twig create mode 100644 assets/components/organisms/headlines/headlines-legend.twig diff --git a/assets/components/organisms/fullwidth-teaser/fullwidth-teaser-horizontal.twig b/assets/components/organisms/fullwidth-teaser/fullwidth-teaser-horizontal.twig index ddf2ef1b3..8b9c68bd6 100644 --- a/assets/components/organisms/fullwidth-teaser/fullwidth-teaser-horizontal.twig +++ b/assets/components/organisms/fullwidth-teaser/fullwidth-teaser-horizontal.twig @@ -2,12 +2,16 @@
+ {% if has_image_legend|default(false) %}
{% include '@atoms/picture/picture-fullwidth-teaser.twig' %}
{% include '@atoms/popover/popover.twig' %}
+ {% else %} + {% include '@atoms/picture/picture-fullwidth-teaser.twig' %} + {% endif %}
diff --git a/assets/components/organisms/fullwidth-teaser/fullwidth-teaser-legend.twig b/assets/components/organisms/fullwidth-teaser/fullwidth-teaser-legend.twig new file mode 100644 index 000000000..6b5d53bab --- /dev/null +++ b/assets/components/organisms/fullwidth-teaser/fullwidth-teaser-legend.twig @@ -0,0 +1,38 @@ +
+ +
+ {% include '@atoms/picture/picture-fullwidth-teaser.twig' %} +
+ {% include '@atoms/popover/popover.twig' %} +
+
+ +
+ +
+
+

+ {% if not title %}{% set title %}Évaluer la durabilité dans le domaine spatial{% endset %}{% endif %} + {{title}} +

+
+ + En savoir plus + {% include '@atoms/icon/icon.twig' with {icon: 'icon-chevron-right'} %} + +
+ +
+

+ {% if not content %} + {% set content %}Le nouveau Space Sustainability Rating accueilli par eSpace, le centre spatial de l’EPFL, encourage le secteur de l’espace à concevoir et à mettre en œuvre des missions spatiales durables et responsables — montrant ainsi la voie pour assurer à long terme une approche durable de l’environnement spatial.{% endset %} + {% endif %} + {{content}} +

+
+ + +
+
diff --git a/assets/components/organisms/fullwidth-teaser/fullwidth-teaser.twig b/assets/components/organisms/fullwidth-teaser/fullwidth-teaser.twig index 6b5d53bab..5f23160a7 100644 --- a/assets/components/organisms/fullwidth-teaser/fullwidth-teaser.twig +++ b/assets/components/organisms/fullwidth-teaser/fullwidth-teaser.twig @@ -1,11 +1,6 @@
-
- {% include '@atoms/picture/picture-fullwidth-teaser.twig' %} -
- {% include '@atoms/popover/popover.twig' %} -
-
+ {% include '@atoms/picture/picture-fullwidth-teaser.twig' %}
diff --git a/assets/components/organisms/fullwidth-teaser/fullwidth-teaser.yml b/assets/components/organisms/fullwidth-teaser/fullwidth-teaser.yml index 655131d04..a155f769b 100644 --- a/assets/components/organisms/fullwidth-teaser/fullwidth-teaser.yml +++ b/assets/components/organisms/fullwidth-teaser/fullwidth-teaser.yml @@ -1,6 +1,12 @@ title: Fullwidth teaser name: fullwidth-teaser variants: + - name: legend + title: Fullwidth teaser with image legend + notes: | + The [popover](#/atoms/popover) component can be used on any Fullwidth teaser variant in order to add a legend to the image. + + The markup structure is similar to the [cover](#/molecules/cover) component. - name: horizontal title: Horizontal - name: left diff --git a/assets/components/organisms/headlines/headlines-legend.twig b/assets/components/organisms/headlines/headlines-legend.twig new file mode 100644 index 000000000..80ad89aeb --- /dev/null +++ b/assets/components/organisms/headlines/headlines-legend.twig @@ -0,0 +1,44 @@ +{% macro card_link(card) %} + +
+

{{ card.title }}

+
+ {% if card.date %} + + + + {% endif %} + {% for item in card.info %} + {{ item }} + {% endfor %} +
+

{{ card.content }}

+
+
+{% endmacro %} +{% import _self as macros %} + +{% set bottomlink = bottomlink|default(true) %} + +{# The intro fullwidth teaser #} +{% include '@organisms/fullwidth-teaser/fullwidth-teaser-horizontal.twig' with { has_image_legend: true } %} + +{# First teasers #} +
+
+
+
+ {% for card in homepage.section_one.cards %} +
+ {{ macros.card_link(card) }} +
+ {% endfor %} +
+ {% if bottomlink %} +

+ {{ homepage.section_one.readmore }} +

+ {% endif %} +
+
+
diff --git a/assets/components/organisms/headlines/headlines.yml b/assets/components/organisms/headlines/headlines.yml index 8aae5de2d..a920f0d6c 100644 --- a/assets/components/organisms/headlines/headlines.yml +++ b/assets/components/organisms/headlines/headlines.yml @@ -1,2 +1,5 @@ title: Headlines name: headlines +variants: +- name: legend + title: Headlines with image legend