Class: FoxTail::IconButtonComponent
- Inherits:
-
ButtonBaseComponent
- Object
- ViewComponent::Base
- Base
- BaseComponent
- ClickableComponent
- ButtonBaseComponent
- FoxTail::IconButtonComponent
- Defined in:
- app/components/fox_tail/icon_button_component.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseComponent
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(icon_or_attributes = {}, html_attributes = {}) ⇒ IconButtonComponent
constructor
A new instance of IconButtonComponent.
Methods inherited from ButtonBaseComponent
Methods inherited from ClickableComponent
#before_render, #link?, #root_tag_name, stimulus_controller_name, #stimulus_controller_options, #use_stimulus?
Methods inherited from BaseComponent
classname_merger, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
Constructor Details
#initialize(icon_or_attributes = {}, html_attributes = {}) ⇒ IconButtonComponent
Returns a new instance of IconButtonComponent.
9 10 11 12 13 14 15 16 17 18 |
# File 'app/components/fox_tail/icon_button_component.rb', line 9 def initialize(icon_or_attributes = {}, html_attributes = {}) if icon_or_attributes.is_a? Hash html_attributes = icon_or_attributes icon_or_attributes = nil end super(html_attributes) with_icon icon_or_attributes if icon_or_attributes.present? end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/fox_tail/icon_button_component.rb', line 20 def call super do icons.each { |icon| concat icon } concat indicator if indicator? if content? || i18n_content.present? concat content_tag(:span, retrieve_content, class: theme.apply(:content, self)) end end end |