From 243d39d6e973fb67fe5bd750b6cdaaa2ebcd25b8 Mon Sep 17 00:00:00 2001 From: Frankie Roberto Date: Mon, 9 Sep 2024 16:15:27 +0100 Subject: [PATCH 1/2] Add summary list row condition 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. --- packages/components/summary-list/template.njk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/components/summary-list/template.njk b/packages/components/summary-list/template.njk index f25befd26..4797661fb 100644 --- a/packages/components/summary-list/template.njk +++ b/packages/components/summary-list/template.njk @@ -10,6 +10,7 @@ {% endmacro -%}
{% for row in params.rows %} + {% if row %}
{{ row.key.html | safe if row.key.html else row.key.text }} @@ -33,5 +34,6 @@ {% endif %}
+ {% endif %} {% endfor %}
From 6a65cd3b96901efc7a0357f96c2a93f52e8f89ee Mon Sep 17 00:00:00 2001 From: Frankie Roberto Date: Mon, 9 Sep 2024 16:26:46 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51342ffba..0177c1740 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) ## 8.3.0 - 24 July 2024