Class: Railsboot::Accordion::ItemComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::Accordion::ItemComponent
- Defined in:
- app/components/railsboot/accordion/item_component.rb
Instance Method Summary collapse
-
#initialize(id:, parent_id: "", expanded: false, **html_attributes) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
- #parent_reference ⇒ Object
Constructor Details
#initialize(id:, parent_id: "", expanded: false, **html_attributes) ⇒ ItemComponent
Returns a new instance of ItemComponent.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/components/railsboot/accordion/item_component.rb', line 5 def initialize(id:, parent_id: "", expanded: false, **html_attributes) @id = id @parent_id = parent_id @expanded = @html_attributes = html_attributes @html_attributes[:tag] = "div" @html_attributes[:class] = class_names( "accordion-item", html_attributes.delete(:class) ) end |
Instance Method Details
#parent_reference ⇒ Object
18 19 20 |
# File 'app/components/railsboot/accordion/item_component.rb', line 18 def parent_reference @parent_id.present? ? {bs_parent: "##{@parent_id}"} : {} end |