From 0e681890d2b553663565b441d5f0bd513e3d64eb Mon Sep 17 00:00:00 2001 From: Ed Horsford Date: Tue, 21 May 2024 10:32:51 +0100 Subject: [PATCH] Fix inset-text not supporting html param (#951) * Fix inset-text not supporting html param --- CHANGELOG.md | 1 + app/components/inset-text/index.njk | 2 +- packages/components/inset-text/README.md | 4 ++-- packages/components/inset-text/template.njk | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f035262..08479fdd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Removing classes from icon card that are not doing anything - Align label bottom margins with fieldset legend bottom margins ([PR 946](https://github.com/nhsuk/nhsuk-frontend/pull/946)). +- Fixed bug with inset-text component requiring uppercase `html` argument. Fixes [Issue 950](https://github.com/nhsuk/nhsuk-frontend/issues/950). ## 8.1.1 - 14 March 2024 diff --git a/app/components/inset-text/index.njk b/app/components/inset-text/index.njk index f1b09f582..42c92d0fa 100644 --- a/app/components/inset-text/index.njk +++ b/app/components/inset-text/index.njk @@ -11,7 +11,7 @@
{{ insetText({ - "HTML": "

You can report any suspected side effect to the UK safety scheme.

" + "html": "

You can report any suspected side effect to the UK safety scheme.

" }) }}
diff --git a/packages/components/inset-text/README.md b/packages/components/inset-text/README.md index ad254f92e..fabc14d62 100644 --- a/packages/components/inset-text/README.md +++ b/packages/components/inset-text/README.md @@ -25,7 +25,7 @@ If you’re using Nunjucks macros in production be aware that using `html` argum {% from 'components/inset-text/macro.njk' import insetText %} {{ insetText({ - "HTML": "

You can report any suspected side effect to the UK safety scheme.

" + "html": "

You can report any suspected side effect to the UK safety scheme.

" }) }} ``` @@ -35,7 +35,7 @@ The inset text Nunjucks macro takes the following arguments: | Name | Type | Required | Description | | -------------- | ------ | -------- | ------------------------------------------------------------------------------------------------- | -| **HTML** | string | Yes | HTML content to be used within the inset text component. | +| **html** | string | Yes | HTML content to be used within the inset text component. | | **classes** | string | No | Optional additional classes to add to the inset text container. Separate each class with a space. | | **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the inset text container. | diff --git a/packages/components/inset-text/template.njk b/packages/components/inset-text/template.njk index 6902580f1..451c856b7 100644 --- a/packages/components/inset-text/template.njk +++ b/packages/components/inset-text/template.njk @@ -2,5 +2,6 @@ {%- if params.classes %} {{ params.classes }}{% endif %}" {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}> Information: - {{ params.HTML | safe }} + {# params.HTML supported for backwards compatibility - see issue #950 #} + {{ (params.html or params.HTML) | safe }}