Skip to content

Commit 42da9de

Browse files
committed
use variable fixed width for quote wrapper top rule to avoid visual regressions
1 parent 520327c commit 42da9de

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

templates/_macros/shared/vf_section_top_rule.jinja

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# Helper macro to render a top rule for a section.
22
# Parameters:
3-
# - top_rule_variant: string, one of "default", "muted", "highlighted", "none"
4-
{%- macro vf_section_top_rule(top_rule_variant="default") -%}
3+
# - top_rule_variant("default" | "muted" | "highlighted" |"none"): variant of horizontal rule to use
4+
# - is_fixed_width(Boolean): Whether to constrain the rule by the fixed content width. Default to False.
5+
# If you don't use this, you should wrap the rule in a .grid-row.
6+
{%- macro vf_section_top_rule(
7+
top_rule_variant="default",
8+
is_fixed_width=False
9+
) -%}
510
{%- set top_rule_variant = top_rule_variant | trim | lower -%}
611
{%- if top_rule_variant not in ["default", "muted", "highlighted", "none"] -%}
712
{%- set top_rule_variant = "default" -%}
813
{%- endif -%}
914

1015
{%- if top_rule_variant != "none" -%}
11-
{%- set top_rule_classes = "p-rule is-fixed-width" -%}
16+
{%- set top_rule_classes = "p-rule" -%}
1217
{%- if top_rule_variant != "default" -%}
1318
{#-
1419
p-rule--highlighted doesn't exist (use p-rule--highlight instead), but p-rule--muted does.
@@ -23,6 +28,10 @@
2328
{%- endif -%}
2429
{%- endif -%}
2530

31+
{%- if is_fixed_width -%}
32+
{%- set top_rule_classes = top_rule_classes + " " + "is-fixed-width" -%}
33+
{%- endif -%}
34+
2635
{%- if top_rule_variant != "none" -%}
2736
<hr class="{{- top_rule_classes -}}"/>
2837
{%- endif -%}

templates/_macros/vf_quote-wrapper.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
<div class="p-section{% if is_shallow %}--shallow{% endif %}">
267267
{#- pattern-level separator -#}
268268
{%- if has_heading_row -%}
269-
{{ vf_section_top_rule("default") }}
269+
{{ vf_section_top_rule(top_rule_variant="default", is_fixed_width=True) }}
270270
{%- endif -%}
271271
{{- _quote_wrapper_heading_block(
272272
heading={

0 commit comments

Comments
 (0)