Sha256: 3165f147191e4f70ea0e34d51fc6ed9e4bd68095c08309cfc241b9cfd3cac209
Contents?: true
Size: 1.8 KB
Versions: 18
Compression:
Stored size: 1.8 KB
Contents
<% add_gem_component_stylesheet("tabs") tabs ||= [] panel_border ||= true unless panel_border == false panel_css_classes = %w(govuk-tabs__panel) panel_css_classes << "gem-c-tabs__panel--no-border" if panel_border == false panel_css_classes = panel_css_classes.join(" ") ga4_tracking ||= false data_module = "govuk-tabs" data_module << " ga4-event-tracker" if ga4_tracking %> <% if tabs.count > 1 %> <div class="govuk-tabs gem-c-tabs" data-module="<%= data_module %>"> <h2 class="govuk-tabs__title"> <%= t("components.tabs.contents") %> </h2> <ul class="govuk-tabs__list"> <% tabs.each_with_index do |tab, index| %> <li class="govuk-tabs__list-item"> <% tab[:tab_data_attributes] ||= {} if ga4_tracking tab[:tab_data_attributes][:ga4_event] = { event_name: "select_content", type: "tabs", text: tab[:label], index: { index_section: index + 1, index_section_count: tabs.length, }, } end %> <%= link_to(tab[:label], "##{tab[:id]}", class: "govuk-tabs__tab", data: tab[:tab_data_attributes]) %> </li> <% end %> </ul> <% tabs.each do |tab| %> <section class="<%= panel_css_classes %>" id="<%= tab[:id] %>"> <% if tab[:title] %> <h2 class="govuk-heading-l"><%= tab[:title] %></h2> <% end %> <%= tab[:content] %> </section> <% end %> </div> <% end %> <% if tabs.count == 1 %> <section id="<%= tabs[0][:id] %>"> <% if tabs[0][:title] %> <h2 class="govuk-heading-l"><%= tabs[0][:title] %></h2> <% end %> <%= tabs[0][:content] %> </section> <% end %>
Version data entries
18 entries across 18 versions & 1 rubygems