Class: DsfrComponent::HeaderComponent::DirectLinkDropdownComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- DsfrComponent::HeaderComponent::DirectLinkDropdownComponent
- Defined in:
- app/components/dsfr_component/header_component/direct_link_dropdown_component.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(title:, active: false, classes: [], html_attributes: {}) ⇒ DirectLinkDropdownComponent
constructor
A new instance of DirectLinkDropdownComponent.
Constructor Details
#initialize(title:, active: false, classes: [], html_attributes: {}) ⇒ DirectLinkDropdownComponent
Returns a new instance of DirectLinkDropdownComponent.
4 5 6 7 8 9 |
# File 'app/components/dsfr_component/header_component/direct_link_dropdown_component.rb', line 4 def initialize(title:, active: false, classes: [], html_attributes: {}) @title = title @active = active super(classes: classes, html_attributes: html_attributes) end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/components/dsfr_component/header_component/direct_link_dropdown_component.rb', line 11 def call tag.(title, **html_attributes) + tag.div(class: 'fr-collapse fr-menu', id: ) do tag.ul(class: 'fr-menu__list') do links.map do |link| tag.li link.call end.join.html_safe end end end |