Sha256: a37a6c219479590c38a8839429e4d334c809874dda81177126e563a46bde98a9

Contents?: true

Size: 1.11 KB

Versions: 278

Compression:

Stored size: 1.11 KB

Contents

<%
  id ||= "warning-text-#{SecureRandom.hex(4)}"
  text_assistive ||= 'Warning'
  text_icon ||= '!'
  large_font ||= false
  highlight_text ||= false
  heading_level ||= 0

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

  text_classes = %w(govuk-warning-text__text)
  text_classes << "gem-c-warning-text__text--no-indent" if text_icon.empty?
  text_classes << "gem-c-warning-text__text--large" if large_font
  text_classes << "gem-c-warning-text__text--highlight" if highlight_text
%>

<%= tag.div id: id, class: "gem-c-warning-text govuk-warning-text" do %>
  <% unless text_icon.empty? %>
    <%= tag.span text_icon, class: "govuk-warning-text__icon", "aria-hidden": "true" %>
  <% end %>
  <% inner_text = capture do %>
    <%= tag.span text_assistive, class: "govuk-warning-text__assistive" %>
    <%= text %>
  <% end %>
  <% if heading_level > 0 %>
    <%= content_tag(shared_helper.get_heading_level, class: text_classes) do %>
      <%= inner_text %>
    <% end %>
  <% else %>
    <%= tag.strong class: text_classes do %>
      <%= inner_text %>
    <% end %>
  <% end %>
<% end %>

Version data entries

278 entries across 278 versions & 1 rubygems

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