Skip to content

Commit

Permalink
Fix inset-text not supporting html param (#951)
Browse files Browse the repository at this point in the history
* Fix inset-text not supporting html param
  • Loading branch information
edwardhorsford authored May 21, 2024
1 parent 3b9d77c commit 0e68189
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/components/inset-text/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">
{{ insetText({
"HTML": "<p>You can report any suspected side effect to the <a href=\"https://yellowcard.mhra.gov.uk/\" title=\"External website\">UK safety scheme</a>.</p>"
"html": "<p>You can report any suspected side effect to the <a href=\"https://yellowcard.mhra.gov.uk/\" title=\"External website\">UK safety scheme</a>.</p>"
}) }}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/components/inset-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<p>You can report any suspected side effect to the <a href=\"https://yellowcard.mhra.gov.uk/\" title=\"External website\">UK safety scheme</a>.</p>"
"html": "<p>You can report any suspected side effect to the <a href=\"https://yellowcard.mhra.gov.uk/\" title=\"External website\">UK safety scheme</a>.</p>"
}) }}
```

Expand All @@ -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. |

Expand Down
3 changes: 2 additions & 1 deletion packages/components/inset-text/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{%- if params.classes %} {{ params.classes }}{% endif %}"
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
<span class="nhsuk-u-visually-hidden">Information: </span>
{{ params.HTML | safe }}
{# params.HTML supported for backwards compatibility - see issue #950 #}
{{ (params.html or params.HTML) | safe }}
</div>

0 comments on commit 0e68189

Please sign in to comment.