Class: Railsboot::Accordion::ItemComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::Accordion::ItemComponent
- Defined in:
- app/components/railsboot/accordion/item_component.rb
Overview
ViewComponent: renders the item block.
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.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/components/railsboot/accordion/item_component.rb', line 7 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
20 21 22 |
# File 'app/components/railsboot/accordion/item_component.rb', line 20 def parent_reference @parent_id.present? ? { bs_parent: "##{@parent_id}" } : {} end |