Class: UI::CommandInput
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::CommandInput
- Includes:
- CommandInputBehavior
- Defined in:
- app/components/ui/command_input.rb
Instance Method Summary collapse
-
#initialize(placeholder: "Type a command or search...", classes: "", **attributes) ⇒ CommandInput
constructor
A new instance of CommandInput.
- #view_template ⇒ Object
Methods included from CommandInputBehavior
#command_input_classes, #command_input_data_attributes, #command_input_html_attributes, #command_input_wrapper_classes
Constructor Details
#initialize(placeholder: "Type a command or search...", classes: "", **attributes) ⇒ CommandInput
Returns a new instance of CommandInput.
6 7 8 9 10 |
# File 'app/components/ui/command_input.rb', line 6 def initialize(placeholder: "Type a command or search...", classes: "", **attributes) @placeholder = placeholder @classes = classes @attributes = attributes end |
Instance Method Details
#view_template ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/ui/command_input.rb', line 12 def view_template div(class: command_input_wrapper_classes) do svg( class: "mr-2 h-4 w-4 shrink-0 opacity-50", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", stroke_width: "2", stroke_linecap: "round", stroke_linejoin: "round" ) do |s| s.circle(cx: "11", cy: "11", r: "8") s.path(d: "m21 21-4.3-4.3") end input(**command_input_html_attributes.deep_merge(@attributes)) end end |