Sha256: 9443239033f2cf6a23a7e4364f421d5be586abb225006ef27ea7583078b5504c

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

<%
  add_gem_component_stylesheet("secondary-navigation")

  id ||= nil
  items ||= []

  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
  component_helper.add_aria_attribute({label: aria_label})
  component_helper.add_class('gem-c-secondary-navigation')
  component_helper.set_id(id)
%>

<% if items.any? %>
  <%= tag.nav(**component_helper.all_attributes) do %>
    <%= tag.ul class: "gem-c-secondary-navigation__list" do %>
      <% items.each do |item| %>
        <%
          item_classes = %w( gem-c-secondary-navigation__list-item )
          item_classes << "gem-c-secondary-navigation__list-item--current" if item[:current]
          item_aria_attributes = { current: "page" } if item[:current]
        %>
        <%= tag.li class: item_classes do %>
          <%= link_to item[:label], item[:href], class: "govuk-link govuk-link--no-visited-state gem-c-secondary-navigation__list-item-link", data: item[:data_attributes], aria: item_aria_attributes %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
govuk_publishing_components-51.1.0 app/views/govuk_publishing_components/components/_secondary_navigation.html.erb
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/_secondary_navigation.html.erb
govuk_publishing_components-50.0.1 app/views/govuk_publishing_components/components/_secondary_navigation.html.erb
govuk_publishing_components-50.0.0 app/views/govuk_publishing_components/components/_secondary_navigation.html.erb
govuk_publishing_components-49.1.0 app/views/govuk_publishing_components/components/_secondary_navigation.html.erb
govuk_publishing_components-49.0.0 app/views/govuk_publishing_components/components/_secondary_navigation.html.erb