Class: Spina::UserInterface::DropdownButtonComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Spina::UserInterface::DropdownButtonComponent
- Defined in:
- app/components/spina/user_interface/dropdown_button_component.rb
Instance Attribute Summary collapse
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
Instance Method Summary collapse
- #call ⇒ Object
- #classes ⇒ Object
-
#initialize(disabled: false) ⇒ DropdownButtonComponent
constructor
A new instance of DropdownButtonComponent.
Constructor Details
#initialize(disabled: false) ⇒ DropdownButtonComponent
Returns a new instance of DropdownButtonComponent.
6 7 8 |
# File 'app/components/spina/user_interface/dropdown_button_component.rb', line 6 def initialize(disabled: false) @disabled = disabled end |
Instance Attribute Details
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
4 5 6 |
# File 'app/components/spina/user_interface/dropdown_button_component.rb', line 4 def disabled @disabled end |
Instance Method Details
#call ⇒ Object
10 11 12 |
# File 'app/components/spina/user_interface/dropdown_button_component.rb', line 10 def call content_tag :button, content, {class: classes, type: :submit, disabled: disabled} end |
#classes ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/components/spina/user_interface/dropdown_button_component.rb', line 14 def classes if disabled "block w-full text-left px-3 py-2 text-sm leading-4 text-gray-400 font-medium cursor-default" else "block w-full text-left px-3 py-2 text-sm leading-4 text-gray-700 hover:bg-gray-100 hover:text-gray-900 font-medium" end end |