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-28.4.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-28.3.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-28.2.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-28.1.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-28.0.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.20.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.19.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.18.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.17.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.16.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.15.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.14.2 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.14.1 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.14.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.13.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.12.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.11.0 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.10.5 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.10.4 app/views/govuk_publishing_components/components/_title.html.erb
govuk_publishing_components-27.10.3 app/views/govuk_publishing_components/components/_title.html.erb