Sha256: 245f3cd0a8ef5714b23c69c773866584bf6cd47b3e45578b05ff5191584fa6f1

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

<%
  add_gem_component_stylesheet("title")

  average_title_length ||= false

  context ||= false
  context_locale ||= false
  context_inside ||= false

  inverse ||= false
  local_assigns[:margin_bottom] ||= 8

  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)

  classes = %w[gem-c-title]
  classes << "gem-c-title--inverse" if inverse
  classes << shared_helper.get_margin_bottom

  heading_classes = %w[gem-c-title__text]
  heading_classes << (average_title_length.present? ? 'govuk-heading-l' : 'govuk-heading-xl')
%>
<% @context_block = capture do %>
  <span class="govuk-caption-xl gem-c-title__context" <%= "lang=#{context_locale}" if context_locale.present? %>>
    <%= context %>
  </span>
<% end %>

<%= content_tag(:div, class: classes) do %>
  <% if context && !context_inside %>
    <%= @context_block %>
  <% end %>

  <h1 class="<%= heading_classes.join(" ") %>">
    <% if context && context_inside %>
      <%= @context_block %>
    <% end %>
    <%= title %>
  </h1>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
govuk_publishing_components-51.1.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/_title.html.erb