Sha256: 15d86ce821a2dcdeb5d40aa269827fe42b94f8e0114c5da43e14014711a67eca

Contents?: true

Size: 1.64 KB

Versions: 79

Compression:

Stored size: 1.64 KB

Contents

<%
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
  big_number_helper = GovukPublishingComponents::Presenters::BigNumberHelper.new(local_assigns)

  number ||= false
  label ||= nil
  href ||= nil
  data_attributes ||= nil
  aria ||= nil
  classes = ["gem-c-big-number"]
  classes << shared_helper.get_margin_bottom

  value_classes = big_number_helper.value_classes
%>
<% if number %>
  <% big_number_value = capture do %>
    <%= tag.span class: value_classes, data: href ? nil : data_attributes do %>
      <%
        # The below check is to account for small symbols awkwardly sitting above the baseline in our typeface and adjust them to sit at the baseline for the purpose of visual harmony
        # Currently the only small symbol used with big numbers are pluses so they are specifically applied in the below code
      %>
      <% if big_number_helper.number_has_plus_suffix? %>
        <%= number[0...-1] %><%= tag.span "+", class: "gem-c-big-number__suffix" %>
      <% else %>
        <%= number %>
      <% end %>
    <% end %>

    <% unless label.nil? %>
      <% # add a virtual space here to handle screen readers printing dictations without a space between the number and the label %>
      <span class="govuk-visually-hidden">&nbsp;</span>
      <span class="gem-c-big-number__label">
        <%= label %>
      </span>
    <% end %>
  <% end %>
  
  <%= tag.div class: classes, aria: aria do %>
    <% unless href.nil? %>
      <%= link_to big_number_value, href, class: "govuk-link gem-c-big-number__link", data: data_attributes %>
    <% else %>
      <%= big_number_value %>
    <% end %>
  <% end %>
<% end %>

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
govuk_publishing_components-34.12.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.11.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.10.1 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.10.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.9.1 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.9.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.8.1 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.8.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.7.1 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.7.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.6.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.5.1 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.5.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.4.2 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.4.1 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.4.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.3.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.2.0 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.1.3 app/views/govuk_publishing_components/components/_big_number.html.erb
govuk_publishing_components-34.1.2 app/views/govuk_publishing_components/components/_big_number.html.erb