Sha256: d7e38c9de043d555a4df7e5c39cf0e337a7436ca5a71ef93827f06d33cc5cf01

Contents?: true

Size: 1.05 KB

Versions: 50

Compression:

Stored size: 1.05 KB

Contents

<%
  average_title_length ||= false

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

  inverse ||= false
  local_assigns[:margin_top] ||= 8
  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_top)
  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

50 entries across 50 versions & 1 rubygems

Version Path
govuk_publishing_components-25.6.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.5.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.4.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.3.1 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.3.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.2.3 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.2.2 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.2.1 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.2.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-25.1.0 app/views/govuk_publishing_components/components/_title.html.erb