Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vanilla-framework",
"version": "4.37.2",
"version": "4.38.0",
"author": {
"email": "webteam@canonical.com",
"name": "Canonical Webteam"
Expand Down
14 changes: 14 additions & 0 deletions releases.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
- version: 4.38.0
features:
- component: Basic section
url: /docs/patterns/basic-section
status: Updated
notes: Added <code>attrs</code> parameter to the section element.
- component: Pricing block
url: /docs/patterns/pricing-block
status: Updated
notes: Added <code>attrs</code> parameter to the section element.
- component: Equal heights
url: /docs/patterns/equal-heights
status: Updated
notes: Added <code>attrs</code> parameter to the section element.
- version: 4.37.0
features:
- component: Icon
Expand Down
12 changes: 10 additions & 2 deletions templates/_macros/vf_basic-section.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,16 @@
# padding: Type of padding to apply to the pattern - "deep", "shallow", "default" (default is "default").
# is_split_on_medium: Boolean to indicate if the section should be split on medium screens (default is false).
# top_rule_variant: Type of HR to render at the top of the pattern. "default" | "muted" (default is "default").
# attrs: A dictionary of attributes to apply to the section element.
{% macro vf_basic_section(
title={},
label_text="",
subtitle={},
items=[],
padding="default",
is_split_on_medium=false,
top_rule_variant="default"
top_rule_variant="default",
attrs={}
) -%}

{%- set padding = padding | trim -%}
Expand All @@ -330,7 +332,13 @@
{%- set has_label = label_text|length > 0 -%}
{%- set has_subtitle = subtitle_text|length > 0 -%}

<section class="{{ padding_classes }}">
<section class="{{ padding_classes }} {{ attrs.get("class", "") -}}"
{%- for attr, value in attrs.items() -%}
{% if attr != "class" %}
{{ attr }}="{{ value }}"
{%- endif -%}
{%- endfor -%}
>
<div class="grid-row--50-50{%- if not is_split_on_medium -%}-on-large{%- endif -%}">
{{ vf_section_top_rule(top_rule_variant) }}
<div class="grid-col">
Expand Down
10 changes: 9 additions & 1 deletion templates/_macros/vf_equal-heights.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{#-
Params
- title_text (string) (required): The text to be displayed as the heading
- attrs (dictionary) (optional): A dictionary of attributes to apply to the equal heights pattern.
- subtitle_text (string) (optional): The text to be displayed as the subtitle
- subtitle_heading_level (int) (optional): The heading level for the subtitle. Can be 4 or 5. Defaults to 5.
- highlight_images (boolean) (optional): If the images need to be highlighted, which means adding a subtle grey background. Not added by default.
Expand All @@ -11,6 +12,7 @@
-#}
{%- macro vf_equal_heights(
title_text,
attrs={},
subtitle_text="",
subtitle_heading_level=5,
highlight_images=false,
Expand All @@ -31,7 +33,13 @@
{% set subtitle_heading_level=5 %}
{%- endif -%}

<div class="p-section">
<div class="p-section {{ attrs.get("class", "") -}}"
{%- for attr, value in attrs.items() -%}
{% if attr != "class" %}
{{ attr }}="{{ value }}"
{%- endif -%}
{%- endfor -%}
>
<hr class="p-rule is-fixed-width"/>
<div class="p-section--shallow">
{%- if has_two_top_cols -%}
Expand Down
10 changes: 9 additions & 1 deletion templates/_macros/vf_pricing-block.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Params
- title_text (string) (required): The text to be displayed as the heading
- top_rule_variant (string) (optional): Variant of the top rule, default is "default". Options are "muted", "highlighted", "default", "none".
- attrs (dictionary) (optional): A dictionary of attributes to apply to the Pricing block section.
- tiers (Array<{
tier_name_text: String (optional),
tier_price_text: String,
Expand All @@ -20,6 +21,7 @@
{%- macro vf_pricing_block(
top_rule_variant="default",
title_text="",
attrs={},
tiers=[]
) -%}
{% set top_rule_variant = top_rule_variant | trim %}
Expand Down Expand Up @@ -86,7 +88,13 @@
<hr class="p-rule{% if top_rule_variant != 'default' %}--{{ rule_class }}{% endif %} is-fixed-width" />
{% endif %}
{%- endmacro -%}
<div class="p-section">
<div class="p-section {{ attrs.get("class", "") -}}"
{%- for attr, value in attrs.items() -%}
{% if attr != "class" %}
{{ attr }}="{{ value }}"
{%- endif -%}
{%- endfor -%}
>
{{ _top_rule() }}
<div class="grid-row">
<div class="grid-col-4 grid-col-medium-4 grid-col-small-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
}
}
}
]
],
attrs= {"id": "mixed-content-section"}
) }}

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

{% call(slot) vf_equal_heights(
title_text="Keep this heading to 2 lines on large screens.",
attrs={ "id": "2-columns-responsive" },
subtitle_text="Ensure the right hand side of this 50/50 split is taller than the left hand side (heading) on its left. This includes the subtitle and description.",
items=[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

{% call(slot) vf_equal_heights(
title_text="Keep this heading to 2 lines on large screens.",
attrs={ "id": "3-columns-responsive" },
subtitle_text="Ensure the right hand side of this 50/50 split is taller than the left hand side (heading) on its left. This includes the subtitle and description.",
items=[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

{% call(slot) vf_equal_heights(
title_text="Keep this heading to 2 lines on large screens.",
attrs={ "id": "4-columns-responsive" },
subtitle_text="Ensure the right hand side of this 50/50 split is taller than the left hand side (heading) on its left. This includes the subtitle and description.",
items=[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{% block content %}
{% call(slot) vf_pricing_block(
title_text='Kubernetes pricing',
attrs={"id": "1-block"},
tiers=[
{
'tier_name_text': 'Kubernetes Explorer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{% block content %}
{% call(slot) vf_pricing_block(
title_text='Kubernetes pricing',
attrs={"id": "2-blocks"},
tiers=[
{
'tier_name_text': 'Kubernetes Explorer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{% block content %}
{% call(slot) vf_pricing_block(
title_text='Kubernetes pricing',
attrs={"id": "3-blocks"},
tiers=[
{
'tier_name_text': 'Kubernetes Explorer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{% block content %}
{% call(slot) vf_pricing_block(
title_text='Kubernetes pricing',
attrs={"id": "4-blocks"},
tiers=[
{
'tier_name_text': 'Kubernetes Explorer',
Expand Down
19 changes: 18 additions & 1 deletion templates/docs/patterns/basic-section/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ below.
<td>
The main title text (rendered as h2)
</td>
</tr>
</tr>
<tr>
<td>
<code>title.link_attrs</code>
Expand Down Expand Up @@ -614,6 +614,23 @@ below.
Variant of <a href="/docs/patterns/rule">horizontal rule</a> to display at the top of the section."
</td>
</tr>
<tr>
<td>
<code>attrs</code>
</td>
<td>
No
</td>
<td>
<code>&lt;Object&gt;</code>
</td>
<td>
<code>N/A</code>
</td>
<td>
Attributes to apply to the basic section. See <a href="/docs/building-vanilla#attribute-forwarding">attribute forwarding docs</a> for more info.
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
17 changes: 17 additions & 0 deletions templates/docs/patterns/equal-heights/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,23 @@ shown below.
<code>H2</code> title text.
</td>
</tr>
<tr>
<td>
<code>attrs</code>
</td>
<td>
No
</td>
<td>
<code>&lt;Object&gt;</code>
</td>
<td>
<code>N/A</code>
</td>
<td>
Attributes to apply to the equal heights pattern. See <a href="/docs/building-vanilla#attribute-forwarding">attribute forwarding docs</a> for more info.
</td>
</tr>
<tr>
<td>
<code>subtitle_text</code>
Expand Down
17 changes: 17 additions & 0 deletions templates/docs/patterns/pricing-block/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@ The `vf_pricing_block` Jinja macro can be used to generate a pricing tier compar
Title of the pricing section.
</td>
</tr>
<tr>
<td>
<code>attrs</code>
</td>
<td>
No
</td>
<td>
<code>&lt;Object&gt;</code>
</td>
<td>
<code>N/A</code>
</td>
<td>
Attributes to apply to the Pricing block pattern. See <a href="/docs/building-vanilla#attribute-forwarding">attribute forwarding docs</a> for more info.
</td>
</tr>
<tr>
<td>
<code>top_rule_variant</code>
Expand Down