@openeuropa/bcl-listing 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/listing.html.twig +40 -50
  2. package/package.json +5 -5
package/listing.html.twig CHANGED
@@ -11,6 +11,8 @@
11
11
  - link: (object of type link)
12
12
  - alignment: (string) (default: '')
13
13
  options ['start', 'end', 'center', 'baseline', 'stretch']
14
+ - image_size: (string) (default: '')
15
+ options ['small', 'large', 'extra-large']
14
16
  - attributes (drupal attrs)
15
17
  #}
16
18
 
@@ -21,6 +23,7 @@
21
23
  {% set _items = items|default([]) %}
22
24
  {% set _variant = variant|default('default-1-col') %}
23
25
  {% set _alignment = alignment|default('') %}
26
+ {% set _image_size = image_size|default('') %}
24
27
  {% set _link = link|default({}) %}
25
28
 
26
29
  {% set _classes = ['bcl-listing', 'bcl-listing--' ~ _variant] %}
@@ -52,19 +55,14 @@
52
55
  {% if _items is not empty %}
53
56
  {% for _card in _items %}
54
57
  {% set _alignment_class = '' %}
55
- {% set _max_width = '' %}
56
- {% set _image = {} %}
57
- {% if _card.image is not empty %}
58
- {% set _image_classes = _card.image.classes ?: '' %}
59
- {% if not _alignment == 'center' %}
60
- {% set _image_classes = _image_classes ? _image_classes ~ ' mb-3' : 'mb-3' %}
61
- {% endif %}
62
- {% set _max_width = 'mw-listing-img' %}
63
- {% set _card = _card|merge({image: _card.image|merge({
64
- classes: _image_classes,
65
- })}) %}
66
- {% elseif _card.date is not empty %}
67
- {% set _max_width = 'mw-col-date mb-3' %}
58
+ {% set _image_classes = _card.image.classes ?: '' %}
59
+ {% set _start_col_classes = 'bcl-card-start-col mb-3 mb-lg-0' %}
60
+ {% set _end_col_classes = 'col-12 col-md' %}
61
+ {% if _image_size is not empty %}
62
+ {% set _start_col_classes = _start_col_classes ~ ' bcl-size-' ~ _image_size %}
63
+ {% endif %}
64
+ {% if 'd-none' in _image_classes %}
65
+ {% set _start_col_classes = _start_col_classes ~ ' d-none d-md-block' %}
68
66
  {% endif %}
69
67
  {% if _alignment is not empty %}
70
68
  {% set _alignment_class = ' align-self-' ~ _alignment %}
@@ -76,7 +74,7 @@
76
74
  title_attributes: _card_title_attributes.addClass(['fs-5'])
77
75
  }) %}
78
76
 
79
- {% if _variant == 'default-1-col' %}
77
+ {% if _variant == 'default-1-col' or _variant == 'default-2-col' or _variant == 'default-3-col' %}
80
78
  {% set _card_classes = [
81
79
  'listing-item',
82
80
  'border-bottom',
@@ -87,45 +85,18 @@
87
85
  {% set _card = _card|merge({
88
86
  horizontal: true,
89
87
  extra_classes_body: 'p-0 pb-md-0 pb-3',
90
- horizontal_grid: {
91
- left_col_classes: 'col-md-3 col-lg-2 rounded ' ~ _max_width ~ _alignment_class,
92
- right_col_classes: 'col-md-9 col-lg-10' ~ _alignment_class,
93
- },
94
- attributes: _card_attributes,
95
- }) %}
96
- {% endif %}
97
-
98
- {% if _variant == 'default-2-col' or _variant == 'default-3-col' %}
99
- {% set _card_classes = [
100
- 'listing-item',
101
- 'border-bottom',
102
- 'border-md-0',
103
- 'border-0',
104
- ] %}
105
- {% set _card_attributes = _card_attributes.addClass(_card_classes) %}
106
- {% set _card = _card|merge({
107
- extra_classes_body: 'p-0 pb-md-0 pb-3',
108
- horizontal: true,
109
88
  attributes: _card_attributes,
89
+ horizontal_grid: {
90
+ left_col_classes: _start_col_classes ~ _alignment_class,
91
+ right_col_classes: _end_col_classes ~ _alignment_class,
92
+ }
110
93
  }) %}
111
-
94
+
112
95
  {% if _variant == 'default-2-col' %}
113
- {% set _card = _card|merge({
114
- horizontal_grid: {
115
- left_col_classes: 'col-xl-3 col-md-5 ' ~ _max_width ~ _alignment_class,
116
- right_col_classes: 'col-xl-9 col-md-7' ~ _alignment_class,
117
- },
118
- }) %}
119
96
  {% set _card_layout = _card_layout|merge({
120
97
  responsive_columns: 2,
121
98
  }) %}
122
- {% else %}
123
- {% set _card = _card|merge({
124
- horizontal_grid: {
125
- left_col_classes: 'col-lg-4 col-md-6 ' ~ _max_width ~ _alignment_class,
126
- right_col_classes: 'col-lg-8 col-md-6' ~ _alignment_class,
127
- },
128
- }) %}
99
+ {% elseif _variant == 'default-3-col' %}
129
100
  {% set _card_layout = _card_layout|merge({
130
101
  attributes: _card_layout.attributes.addClass(['row-cols-md-2']),
131
102
  responsive_columns: 3,
@@ -150,9 +121,19 @@
150
121
  extra_classes_body: "pt-0",
151
122
  }) %}
152
123
  {% endif %}
153
- {% set _card_layout = _card_layout|merge({
154
- cols_extra_classes: 'mt-4-5',
155
- }) %}
124
+ {% set _card_layout = _card_layout|merge({
125
+ cols_extra_classes: 'mt-4-5',
126
+ }) %}
127
+ {% if _card.image is not empty %}
128
+ {% set _image_classes = _card.image.classes ?: '' %}
129
+ {% if not _alignment == 'center' %}
130
+ {% set _image_classes = _image_classes ? _image_classes ~ ' mb-3' : 'mb-3' %}
131
+ {% endif %}
132
+ {% set _card = _card|merge({image: _card.image|merge({
133
+ classes: _image_classes,
134
+ })}) %}
135
+ {% endif %}
136
+
156
137
  {% endif %}
157
138
 
158
139
  {% if _variant == 'highlight-2-col' or variant == 'highlight-3-col' %}
@@ -173,6 +154,15 @@
173
154
  extra_classes_body: 'pt-0',
174
155
  }) %}
175
156
  {% endif %}
157
+ {% if _card.image is not empty %}
158
+ {% set _image_classes = _card.image.classes ?: '' %}
159
+ {% if not _alignment == 'center' %}
160
+ {% set _image_classes = _image_classes ? _image_classes ~ ' mb-3' : 'mb-3' %}
161
+ {% endif %}
162
+ {% set _card = _card|merge({image: _card.image|merge({
163
+ classes: _image_classes,
164
+ })}) %}
165
+ {% endif %}
176
166
  {% set _card_layout = _card_layout|merge({ gutter: '4' }) %}
177
167
  {% if variant == 'highlight-2-col' %}
178
168
  {% set _card_layout = _card_layout|merge({ responsive_columns: 2 }) %}
package/package.json CHANGED
@@ -2,15 +2,15 @@
2
2
  "name": "@openeuropa/bcl-listing",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "0.24.0",
5
+ "version": "0.25.0",
6
6
  "description": "OE - BCL Listing",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
10
  "dependencies": {
11
- "@openeuropa/bcl-card-layout": "^0.24.0",
12
- "@openeuropa/bcl-heading": "^0.24.0",
13
- "@openeuropa/bcl-link": "^0.24.0"
11
+ "@openeuropa/bcl-card-layout": "^0.25.0",
12
+ "@openeuropa/bcl-heading": "^0.25.0",
13
+ "@openeuropa/bcl-link": "^0.25.0"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -26,5 +26,5 @@
26
26
  "design-system",
27
27
  "twig"
28
28
  ],
29
- "gitHead": "a46bb6bc12771da4667516dc7b0665b00504ade2"
29
+ "gitHead": "f50c7dfeab8695bbb5c18d5f7d5304509512268a"
30
30
  }