Skip to content

Commit 7ffcb5a

Browse files
Merge pull request #5746 from canonical/WD-33213
feat: add customizable padding to tiered lists
2 parents 11c9b08 + 14c9fe2 commit 7ffcb5a

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

releases.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
url: /docs/base/tables#sortable-updated
55
status: Updated
66
notes: We've added the table sort button, which enables keyboard-accessible table sorting.
7+
- component: Tiered list
8+
url: /docs/patterns/tiered-list
9+
status: Updated
10+
notes: Added a new <code>padding</code> parameter to customize the bottom padding.
711
- version: 4.40.0
812
features:
913
- component: Logo section

templates/_macros/vf_tiered-list.jinja

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,33 @@
33
# desktop vs. 50/50 split between title/description
44
# is_list_full_width_on_tablet: whether list title/description each have their
55
# own row on tablet vs. 50/50 split between title/description
6+
# padding: Type of padding to apply. Options are "deep", "shallow", "default". Default is "default".
67
# Slots
78
# title: top-level title element
89
# description: top-level description element
910
# list_item_title_[1-25]: title element of each child list item
1011
# list_item_description_[1-25]: description element of each child list item
1112
# cta: CTA block element
1213
{% macro vf_tiered_list(
14+
padding="default",
1315
is_description_full_width_on_desktop=true,
1416
is_list_full_width_on_tablet=true) -%}
1517
{%- set title_content = caller('title') -%}
1618
{%- set description_content = caller('description') -%}
1719
{%- set has_description = description_content|trim|length > 0 -%}
1820
{%- set cta_content = caller('cta') -%}
1921
{%- set has_cta = cta_content|trim|length > 0 -%}
22+
{%- set padding = padding | trim -%}
23+
{%- if padding not in ["deep", "shallow", "default"] -%}
24+
{%- set padding = "default" -%}
25+
{%- endif -%}
26+
{%- if padding == "default" -%}
27+
{%- set padding_classes = "p-section" -%}
28+
{%- else -%}
29+
{%- set padding_classes = "p-section--" + padding -%}
30+
{%- endif -%}
2031

21-
<div class="p-section u-fixed-width">
32+
<div class="{{ padding_classes }} u-fixed-width">
2233
<hr class="p-rule">
2334
<div class="p-section--shallow">
2435
{% if has_description == true -%}

templates/docs/patterns/tiered-list/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,26 @@ The `vf_tiered_list` Jinja macro can be used to generate a tiered list pattern.
155155
Whether the list element should be full-width on tablet
156156
</td>
157157
</tr>
158+
<tr>
159+
<td>
160+
<code>padding</code>
161+
</td>
162+
<td>
163+
No
164+
</td>
165+
<td>
166+
One of:<br>
167+
<code>'deep'</code>,<br>
168+
<code>'shallow'</code>,<br>
169+
<code>'default'</code>
170+
</td>
171+
<td>
172+
<code>'default'</code>
173+
</td>
174+
<td>
175+
Padding variant for the section
176+
</td>
177+
</tr>
158178
</tbody>
159179
</table>
160180
</div>

0 commit comments

Comments
 (0)