Skip to content

Commit

Permalink
Merge pull request #4522 from alphagov/step-nav-related-component-wra…
Browse files Browse the repository at this point in the history
…pper

Use component wrapper on step nav related component
  • Loading branch information
AshGDS authored Jan 7, 2025
2 parents 297db84 + 69a283f commit 4ec62b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Remove chat entry component ([PR #4512](https://github.com/alphagov/govuk_publishing_components/pull/4512))
* Use component wrapper on skip link component ([PR #4520](https://github.com/alphagov/govuk_publishing_components/pull/4520))
* Use component wrapper on step nav header component ([PR #4521](https://github.com/alphagov/govuk_publishing_components/pull/4521))
* Use component wrapper on step nav related component ([PR #4522](https://github.com/alphagov/govuk_publishing_components/pull/4522))

## 46.4.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
links ||= []
pretitle ||= t("components.step_by_step_nav_related.part_of")
always_display_as_list ||= false
classes = %w(gem-c-step-nav-related)
classes << "gem-c-step-nav-related--singular" if links.length == 1
data = {}
data[:module] = "ga4-link-tracker" unless disable_ga4

component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
component_helper.add_class("gem-c-step-nav-related")
component_helper.add_class("gem-c-step-nav-related--singular") if links.length == 1
component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
%>
<% if links.any? %>
<%= tag.div(class: classes, data: data) do %>
<%= tag.div(**component_helper.all_attributes) do %>
<h2 class="gem-c-step-nav-related__heading">
<span class="gem-c-step-nav-related__pretitle"><%= pretitle %></span>
<% if links.length == 1 && !always_display_as_list %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ accessibility_criteria: |
- display multiple links outside of a heading in a separate list
shared_accessibility_criteria:
- link
uses_component_wrapper_helper: true
examples:
default:
data:
Expand Down

0 comments on commit 4ec62b5

Please sign in to comment.