Sha256: 96b1c2cfcfdc7af13befcb92c328e0bad9efd4157723c8a75b21b439275c9164
Contents?: true
Size: 1.75 KB
Versions: 60
Compression:
Stored size: 1.75 KB
Contents
<% heading ||= nil items ||= nil sub_heading_level ||= 3 two_column_layout ||= false local_assigns ||= nil data_attributes ||= nil ul_classes = %w[gem-c-cards__list] ul_classes << 'gem-c-cards__list--two-column-desktop' if two_column_layout shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) %> <% if items.present? %> <div class="gem-c-cards"> <% if heading %> <%= content_tag(shared_helper.get_heading_level, class: "gem-c-cards__heading govuk-heading-m") do %> <%= heading %> <% end %> <% end %> <%# data-track-count is used for analytics purposes in https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js %> <%= content_tag('ul', class: ul_classes, "data-track-count": "cardList" ) do %> <% items.each do |item| link = item[:link] if !link[:path].present? raise ArgumentError, "The cards component requires a href for all the links" end %> <li class="gem-c-cards__list-item"> <div class="gem-c-cards__list-item-wrapper"> <%= content_tag("h#{sub_heading_level}", class: "gem-c-cards__sub-heading govuk-heading-s") do %> <%= link_to link[:text], link[:path], class: "govuk-link gem-c-cards__link", data: link[:data_attributes], "data-track-count": "cardLink" %> <% end %> <% if item[:description] %> <p class="govuk-body gem-c-cards__description"><%= item[:description] %></p> <% end %> </div> </li> <% end %> <% end %> </div> <% end %>
Version data entries
60 entries across 60 versions & 1 rubygems