Skip to content

Commit

Permalink
Merge pull request #4531 from alphagov/warning-text-component-wrapper
Browse files Browse the repository at this point in the history
Use component wrapper on warning text component
  • Loading branch information
AshGDS authored Jan 8, 2025
2 parents 61d09e4 + 6ad364f commit f4b230b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Use component wrapper on summary card component ([PR #4528](https://github.com/alphagov/govuk_publishing_components/pull/4528))
* Use component wrapper on summary list component ([PR #4529](https://github.com/alphagov/govuk_publishing_components/pull/4529))
* Use component wrapper on translation nav component ([PR #4530](https://github.com/alphagov/govuk_publishing_components/pull/4530))
* Use component wrapper on warning text component ([PR #4351](https://github.com/alphagov/govuk_publishing_components/pull/4531))

## 47.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
text_classes << "gem-c-warning-text__text--no-indent" if text_icon.empty?
text_classes << "gem-c-warning-text__text--large" if large_font
text_classes << "gem-c-warning-text__text--highlight" if highlight_text

component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.set_id(id)
component_helper.add_class("gem-c-warning-text govuk-warning-text")
%>

<%= tag.div id: id, class: "gem-c-warning-text govuk-warning-text" do %>
<%= tag.div(**component_helper.all_attributes) do %>
<% unless text_icon.empty? %>
<%= tag.span text_icon, class: "govuk-warning-text__icon", "aria-hidden": "true" %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ govuk_frontend_components:
- warning-text
accessibility_criteria: |
All text must have a contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast)
uses_component_wrapper_helper: true
examples:
default:
data:
Expand Down

0 comments on commit f4b230b

Please sign in to comment.