Skip to content

Commit

Permalink
Use component wrapper on step nav header component
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGDS committed Jan 6, 2025
1 parent c54d590 commit 785b48d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
]
breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs)

data = {}
data[:module] = "ga4-link-tracker" unless disable_ga4
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)

unless disable_ga4
component_helper.add_data_attribute({ module: "ga4-link-tracker" })
ga4_data = {
event_name: "navigation",
type: "super breadcrumb",
Expand All @@ -23,15 +23,15 @@
end

shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
classes = %w[gem-c-step-nav-header]
classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
component_helper.add_class("gem-c-step-nav-header")
component_helper.add_class(shared_helper.get_margin_bottom) if local_assigns[:margin_bottom]
%>
<% if title %>
<script type="application/ld+json">
<%= raw JSON.pretty_generate(breadcrumb_presenter.structured_data) %>
</script>

<%= tag.div(class: classes, data: data) do %>
<%= tag.div(**component_helper.all_attributes) do %>
<strong class="gem-c-step-nav-header__part-of">Part of</strong>
<% if path %>
<a href="<%= path %>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ accessibility_criteria: |
Always place the step by step navigation header at the top of a page, before the `<main>` element. Placing the component here means that the "Skip to main content" link allows the user to skip all navigation links, including the step by step navigation header.
shared_accessibility_criteria:
- link
uses_component_wrapper_helper: true
examples:
default:
data:
Expand Down

0 comments on commit 785b48d

Please sign in to comment.