Class: Blacklight::SearchButtonComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/search_button_component.rb

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(text:, id:) ⇒ SearchButtonComponent

Returns a new instance of SearchButtonComponent.



5
6
7
8
# File 'app/components/blacklight/search_button_component.rb', line 5

def initialize(text:, id:)
  @text = text
  @id = id
end

Instance Method Details

#callObject



10
11
12
13
14
15
# File 'app/components/blacklight/search_button_component.rb', line 10

def call
  tag.button(class: 'btn btn-primary search-btn', type: 'submit', id: @id) do
    tag.span(@text, class: "visually-hidden-sm me-sm-1 submit-search-text") +
      render(Blacklight::Icons::SearchComponent.new)
  end
end