Skip to content

Commit

Permalink
EWPP-4328: Theme four columns variant and adapt the compositions bloc…
Browse files Browse the repository at this point in the history
…k to render it.
  • Loading branch information
22Alexandra committed May 27, 2024
1 parent 44d785e commit 076540e
Show file tree
Hide file tree
Showing 5 changed files with 368 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,34 @@
</div>
</div>
{% endif %}
{% if items is not empty and _columns == 4 %}
<div class="ecl-row ecl-u-border-color-neutral ecl-u-border-width-1 ecl-u-border-bottom ecl-u-pb-l">
<div class="ecl-col-l-3 ecl-u-d-flex ecl-u-flex-column">
{{ items.0 }}
</div>
{% if items|length > 1 %}
<div class="ecl-col-l-3 ecl-u-d-flex ecl-u-flex-column">
{% for item in items|slice(1, 2) %}
{{ item }}
{% endfor %}
</div>
{% endif %}
{% if items.3 is defined and items.3 is not empty %}
<div class="ecl-col-l-3 ecl-u-d-flex ecl-u-flex-column">
{{ items.3 }}
</div>
{% endif %}
{% if items|length > 4 %}
<div class="ecl-col-l-3 ecl-u-d-flex ecl-u-flex-column">
{% for item in items|slice(4, 2) %}
{{ item }}
{% endfor %}
</div>
{% endif %}
</div>
{% endif %}
{% if see_more is not empty %}
<div class="ecl-u-mt-s">
<div class="ecl-u-mt-m">
{% include '@ecl-twig/link' with see_more %}
</div>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ highlighted_list:
label: "Items"
description: "List of items compatible with the ECL Content item component."
preview:
- title: "Item 2"
- title: "Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem"
detail: "Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem."
meta:
- "Item 2 primary meta"
Expand All @@ -62,7 +62,7 @@ highlighted_list:
definition: "Thursday 15 November, 08:00 AM to Friday 16 November"
- term: "Where"
definition: "The EGG, Rue Barra 175, 1070 Brussels, Belgium"
- title: "Item 3"
- title: "In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo"
url: "https://external.com"
detail: "In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam"
meta:
Expand All @@ -75,7 +75,7 @@ highlighted_list:
src: "https://loremflickr.com/1200/900/arch"
alt: "Alternative text for image"
image_position: "top"
- title: "Item 4"
- title: "Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim"
url: "#"
detail: "Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam"
meta:
Expand All @@ -89,7 +89,7 @@ highlighted_list:
icon: "clock"
- label: "Brussels"
icon: "location"
- title: "Item 5"
- title: "Aenean imperdiet. Etiam ultricies nisi vel augue"
url: "#"
detail: "Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorpe"
meta:
Expand All @@ -98,7 +98,7 @@ highlighted_list:
image:
src: "https://loremflickr.com/1200/900/arch"
alt: "Alternative text for image"
- title: "Item 6"
- title: "Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero"
url: "#"
detail: "Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum."
meta:
Expand All @@ -107,7 +107,9 @@ highlighted_list:
image:
src: "https://loremflickr.com/1200/900/arch"
alt: "Alternative text for image"
- title: "Item 7"
- title: "Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero"
detail: "Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum."
- title: "Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero"
detail: "Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum."
see_more_label:
type: "text"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{#
/**
* @file
* Highlighted list pattern - Four columns layout variant.
*/
#}

{% set highlighted_item = [] %}

{# Prepare the items array. #}
{% set _items = [] %}
{% if items is defined and items is not empty %}
{% set _item = [] %}
{% for item in items|slice(0,6) %}
{% set _item = pattern('list_item', {
'title': item.title,
'url': item.url,
'external_link': item.external_link,
'meta': item.meta,
'secondary_meta': item.secondary_meta,
'image': {
'src': (loop.first or loop.index == 4) ? item.image.src : '',
'alt': (loop.first or loop.index == 4) ? item.image.alt : '',
'size': (loop.first or loop.index == 4) ? 'medium' : '',
},
'image_position': (loop.first or loop.index == 4) ? 'top' : '',
'divider': (loop.index == 2 or loop.index == 5) ? true : false,
'extra_classes': (loop.index == 2 or loop.index == 5) ? 'ecl-u-flex-grow-1 ecl-u-mb-m' : 'ecl-u-flex-grow-1',
}, 'default') %}
{% set _items = _items|merge([_item]) %}
{% endfor %}
{% endif %}

{# Prepare the see more link. #}
{% if see_more_url is defined and see_more_url is not empty %}
{% set _see_more = {
link: {
type: 'standalone',
label: see_more_label|default(see_more_url),
path: see_more_url,
external: see_more_url|is_external_url,
icon_path: ecl_icon_path
},
icon: {
path: ecl_icon_path,
name: 'arrow-left',
size: 'xs',
transform: 'rotate-180'
}
} %}
{% endif %}

{% include '@oe_theme/compositions/ec-component-highlighted-news-block/highlighted-news-block.html.twig' with {
'columns': 4,
'title': title|default(''),
'items': _items,
'see_more': _see_more,
'detail': detail|default(''),
} only %}

Loading

0 comments on commit 076540e

Please sign in to comment.