diff --git a/CHANGELOG.md b/CHANGELOG.md index 342365034d..da798cfeee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * Add canonical_url value to GA4 page view tracking ([PR #4500](https://github.com/alphagov/govuk_publishing_components/pull/4500)) * Add margin_bottom option to component wrapper helper ([PR #4494](https://github.com/alphagov/govuk_publishing_components/pull/4494)) * Limit GA4 search term tracking to 500 characters ([PR #4496](https://github.com/alphagov/govuk_publishing_components/pull/4496)) +* Use component wrapper on step nav component ([PR #4482](https://github.com/alphagov/govuk_publishing_components/pull/4482)) ## 46.3.1 diff --git a/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb b/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb index 9d229cc700..1f75c7ba05 100644 --- a/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +++ b/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb @@ -19,19 +19,24 @@ step_nav_helper = GovukPublishingComponents::Presenters::StepByStepNavHelper.new disable_ga4 ||= false + + component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) + component_helper.add_data_attribute({ + module: "gemstepnav", + show_text: t("components.step_by_step_nav.show"), + hide_text: t("components.step_by_step_nav.hide"), + show_all_text: t("components.step_by_step_nav.show_all"), + hide_all_text: t("components.step_by_step_nav.hide_all") + }) + component_helper.add_data_attribute({ module: "ga4-event-tracker", ga4_expandable: "", }) unless disable_ga4 + component_helper.add_data_attribute({ remember: "" }) if remember_last_step + component_helper.add_data_attribute({ id: tracking_id }) if tracking_id + component_helper.add_class("gem-c-step-nav js-hidden") + component_helper.add_class("govuk-!-display-none-print") if small + component_helper.add_class("gem-c-step-nav--large") unless small %> <% if steps %> -