Class: Maglev::Uikit::Form::SearchFormComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Maglev::Uikit::Form::SearchFormComponent
- Defined in:
- app/components/maglev/uikit/form/search_form_component.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#placeholder ⇒ Object
readonly
Returns the value of attribute placeholder.
-
#search_path ⇒ Object
readonly
Returns the value of attribute search_path.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #class_names ⇒ Object
- #clear_button_class_names ⇒ Object
-
#initialize(name:, value:, search_path:, options: {}) ⇒ SearchFormComponent
constructor
A new instance of SearchFormComponent.
- #value_size ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(name:, value:, search_path:, options: {}) ⇒ SearchFormComponent
Returns a new instance of SearchFormComponent.
9 10 11 12 13 14 15 16 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 9 def initialize(name:, value:, search_path:, options: {}) @name = name @value = value @search_path = search_path @placeholder = [:placeholder] @class_names = [:class_names] @data = [:data] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 7 def data @data end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 7 def name @name end |
#placeholder ⇒ Object (readonly)
Returns the value of attribute placeholder.
7 8 9 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 7 def placeholder @placeholder end |
#search_path ⇒ Object (readonly)
Returns the value of attribute search_path.
7 8 9 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 7 def search_path @search_path end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 7 def value @value end |
Instance Method Details
#class_names ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 18 def class_names class_variants( base: %( inline-flex items-center py-2 px-4 rounded bg-gray-100 text-gray-800 has-[:focus]:ring has-[:focus]:ring-inset has-[:focus]:ring-2 has-[:focus]:ring-editor-primary/50 ) ).render(class: @class_names || '') end |
#clear_button_class_names ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 27 def (...) class_variants( base: 'ml-1 text-gray-500 cursor-pointer', variants: { invisible: 'invisible' } ).render(invisible: value_size.zero?) end |
#value_size ⇒ Object
36 37 38 |
# File 'app/components/maglev/uikit/form/search_form_component.rb', line 36 def value_size value&.size || 0 end |