Sha256: c57be63243e7437acb008b1af9dccda9e4cfd73f5ced181c376c4e724ad953ed

Contents?: true

Size: 1.87 KB

Versions: 23

Compression:

Stored size: 1.87 KB

Contents

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

  aria_controls ||= nil
  button_text ||= t("components.search_box.search_button")
  id ||= "search-main-" + SecureRandom.hex(4)
  label_size ||= nil
  label_text ||= t("components.search_box.label")
  name ||= "q"
  no_border ||= false
  size ||= ""
  value ||= ""

  data_attributes ||= {}
  data_attributes[:module] = 'gem-track-click'

  label_classes = []
  if (shared_helper.valid_heading_size?(label_size))
    label_classes << "govuk-label govuk-label--#{label_size}"
  else
    label_classes << "gem-c-search__label"
  end

  classes = %w[gem-c-search govuk-!-display-none-print]
  classes << (shared_helper.get_margin_top)
  classes << (shared_helper.get_margin_bottom) if local_assigns[:margin_bottom]
  classes << "gem-c-search--large" if size == "large"
  classes << "gem-c-search--no-border" if no_border
  if local_assigns[:on_govuk_blue].eql?(true)
    classes << "gem-c-search--on-govuk-blue"
  else
    classes << "gem-c-search--on-white"
  end
  classes << "gem-c-search--separate-label" if local_assigns.include?(:inline_label) or local_assigns.include?(:label_size)
%>

<div class="<%= classes.join(" ") %>" data-module="gem-toggle-input-class-on-focus">
  <%= tag.label({ for: id, class: label_classes }) do %>
    <%= label_text %>
  <% end %>
  <div class="gem-c-search__item-wrapper">
    <%= tag.input(
      aria: {
        controls: aria_controls,
      },
      class: "gem-c-search__item gem-c-search__input js-class-toggle",
      id: id,
      name: name,
      title: t("components.search_box.input_title"),
      type: "search",
      value: value,
    ) %>
    <div class="gem-c-search__item gem-c-search__submit-wrapper">
      <%= tag.button class: "gem-c-search__submit", type: "submit", data: data_attributes do %>
        <%= button_text %>
      <% end %>
    </div>
  </div>
</div>

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
govuk_publishing_components-27.8.1 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.8.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.7.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.6.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.5.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.4.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.3.1 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.3.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.2.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.1.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-27.0.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-26.0.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-25.7.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-25.6.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-25.5.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-25.4.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-25.3.1 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-25.3.0 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-25.2.3 app/views/govuk_publishing_components/components/_search.html.erb
govuk_publishing_components-25.2.2 app/views/govuk_publishing_components/components/_search.html.erb