Skip to content

Commit

Permalink
Add summary list row condition (#1008)
Browse files Browse the repository at this point in the history
This wraps all of the the HTML for a summary list row in a condition which checks whether the row object is present.

This allows inline conditions within the Nunjucks macro, which can be handy for prototyping.
  • Loading branch information
frankieroberto authored Sep 10, 2024
1 parent e8f9d03 commit 5e44a2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fix Sass deprecation on `mix` function (passing a number without unit) ([PR 995](https://github.com/nhsuk/nhsuk-frontend/pull/995))
- Add nhsukAttributes macro, copied from GOV.UK ([PR 998](https://github.com/nhsuk/nhsuk-frontend/pull/998))
- Add support for inline conditions on summary list rows ([PR 1008](https://github.com/nhsuk/nhsuk-frontend/pull/1008))
- Change "Contact us" in the footer link examples to "Give us feedback" ([PR 972](https://github.com/nhsuk/nhsuk-frontend/pull/972))
- Adjusted default spacing of back link component ([PR 964](https://github.com/nhsuk/nhsuk-frontend/pull/964))
- Reduce main wrapper padding on mobile ([PR 1003](https://github.com/nhsuk/nhsuk-frontend/pull/1003))
Expand Down
2 changes: 2 additions & 0 deletions packages/components/summary-list/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{% endmacro -%}
<dl class="nhsuk-summary-list {%- if params.classes %} {{ params.classes }}{% endif %}" {{- nhsukAttributes(params.attributes) }}>
{% for row in params.rows %}
{% if row %}
<div class="nhsuk-summary-list__row">
<dt class="nhsuk-summary-list__key {%- if row.key.classes %} {{ row.key.classes }}{% endif %}">
{{ row.key.html | safe if row.key.html else row.key.text }}
Expand All @@ -33,5 +34,6 @@
</dd>
{% endif %}
</div>
{% endif %}
{% endfor %}
</dl>

0 comments on commit 5e44a2e

Please sign in to comment.