Sha256: 5ada6d00035a98e2516866d656e4e047c4fe8d8aec63806bda03369577356041
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
<% add_gem_component_stylesheet("cards") heading ||= nil items ||= nil sub_heading_level ||= 3 two_column_layout ||= false 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) component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) component_helper.add_class("gem-c-cards") %> <% if items.present? %> <%= tag.div(**component_helper.all_attributes) do %> <% if heading %> <%= content_tag(shared_helper.get_heading_level, class: "gem-c-cards__heading govuk-heading-m") do %> <%= heading %> <% end %> <% end %> <%= content_tag('ul', class: ul_classes ) 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] %> <% end %> <% if item[:description] %> <p class="govuk-body gem-c-cards__description"><%= item[:description] %></p> <% end %> </div> </li> <% end %> <% end %> <% end %> <% end %>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
govuk_publishing_components-41.0.0 | app/views/govuk_publishing_components/components/_cards.html.erb |