<% add_gem_component_stylesheet("action-link") local_assigns[:margin_bottom] ||= 0 text ||= false nowrap_text ||= false href ||= false subtext ||= false subtext_href ||= false mobile_subtext ||= false inverse ||= false simple ||= false simple_light ||= false dark_icon ||= false dark_large_icon ||= false light_icon ||= false css_classes = %w(gem-c-action-link) css_classes << "gem-c-action-link--inverse" if inverse css_classes << "gem-c-action-link--dark-icon" if dark_icon css_classes << "gem-c-action-link--dark-large-icon" if dark_large_icon css_classes << "gem-c-action-link--light-icon" if light_icon css_classes << "gem-c-action-link--simple" if simple css_classes << "gem-c-action-link--simple-light" if simple_light css_classes << "gem-c-action-link--with-subtext" if subtext css_classes << "gem-c-action-link--mobile-subtext" if mobile_subtext link_classes = %w(govuk-link gem-c-action-link__link gem-c-force-print-link-styles) link_classes << "govuk-link--inverse" if inverse component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns) component_helper.add_class(css_classes.join(" ")) %> <% if text.present? %> <%= tag.div(**component_helper.all_attributes) do %> <% contents = capture do %> <% main_text = capture do %> <%= text %> <%= content_tag(:span, nowrap_text, class: "gem-c-action-link__nowrap-text") if nowrap_text %> <% end %> <% if href.present? %> <%= link_to href, class: link_classes do %> <%= main_text %> <% end %> <% else %> <%= main_text %> <% end %> <% if subtext %> <% if subtext_href %> <%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") do %> <%= link_to subtext, subtext_href, class: link_classes %> <% end %> <% else %> <%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") %> <% end %> <% end %> <% end %> <% if subtext %> <%= content_tag(:span, contents, class: "gem-c-action-link__contents-wrapper") %> <% else %> <%= contents %> <% end %> <% end %> <% end %>