Sha256: 72b2feb520fe99f02a26a594ff7c8c708ac045e30ee739a5682b7c7f19210c37

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

Stored size: 1.5 KB

Contents

<%
  local_assigns[:margin_bottom] ||= 0
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)

  text ||= false
  nowrap_text ||= false
  href ||= false
  subtext ||= false
  light_text ||= false
  simple ||= false
  dark_icon ||= false
  data ||= nil
  classes ||= nil

  css_classes = %w(gem-c-action-link)
  css_classes << "gem-c-action-link--light-text" if light_text
  css_classes << "gem-c-action-link--dark-icon" if dark_icon
  css_classes << "gem-c-action-link--simple" if simple
  css_classes << "gem-c-action-link--with-subtext" if subtext
  css_classes << (shared_helper.get_margin_bottom)

  link_classes = %w(govuk-link gem-c-action-link__link)
  link_classes << shared_helper.classes if classes
%>
<% if href.present? && text.present? %>
  <div class="<%= css_classes.join(' ') %>">
    <% contents = capture do %>
      <span class="gem-c-action-link__link-wrapper">
        <%= link_to  href, :class => link_classes, :data => data do %>
          <%= text %>
          <%= content_tag(:span, nowrap_text, class: "gem-c-action-link__nowrap-text") if nowrap_text %>
        <% end %>
      </span>
      <% if subtext %>
        <span class="gem-c-action-link__subtext-wrapper">
          <%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") %>
        </span>
      <% end %>
    <% end %>

    <% if subtext %>
      <%= content_tag(:span, contents, class: "gem-c-action-link__contents-wrapper") %>
    <% else %>
      <%= contents %>
    <% end %>
  </div>
<% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
govuk_publishing_components-21.54.0 app/views/govuk_publishing_components/components/_action_link.html.erb
govuk_publishing_components-21.53.0 app/views/govuk_publishing_components/components/_action_link.html.erb
govuk_publishing_components-21.52.1 app/views/govuk_publishing_components/components/_action_link.html.erb
govuk_publishing_components-21.52.0 app/views/govuk_publishing_components/components/_action_link.html.erb
govuk_publishing_components-21.51.0 app/views/govuk_publishing_components/components/_action_link.html.erb
govuk_publishing_components-21.50.1 app/views/govuk_publishing_components/components/_action_link.html.erb