Class: KozenetUi::HeaderComponent::SearchComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/kozenet_ui/header_component/search_component.rb

Overview

Search section for the HeaderComponent Renders a search input or form in the header

Examples:

<%= render KozenetUi::HeaderComponent::SearchComponent.new(placeholder: "Search...") %>

Constant Summary

Constants inherited from BaseComponent

BaseComponent::UNSET

Instance Attribute Summary

Attributes inherited from BaseComponent

#html_options, #size, #variant

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SearchComponent

rubocop:disable Metrics/MethodLength



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/components/kozenet_ui/header_component/search_component.rb', line 12

def initialize(options = {})
  placeholder = options.fetch(:placeholder, "Search...")
  name = options.fetch(:name, "q")
  value = options.fetch(:value, nil)
  action = options.fetch(:action, "#")
  method = options.fetch(:method, :get)
  html_options = options.fetch(:html_options, {})
  super(**html_options)
  @placeholder = placeholder
  @name = name
  @value = value
  @action = action
  @method = method
end