Class: SdrViewComponents::Elements::Navigation::DropdownHeaderComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::Elements::Navigation::DropdownHeaderComponent
- Defined in:
- app/components/sdr_view_components/elements/navigation/dropdown_header_component.rb
Overview
Component for rendering a header within a dropdown menu.
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #call ⇒ Object
- #classes ⇒ Object
-
#initialize(text:, classes: []) ⇒ DropdownHeaderComponent
constructor
A new instance of DropdownHeaderComponent.
Methods inherited from BaseComponent
#args_for, #mark_label_required, #merge_actions, #merge_classes
Constructor Details
#initialize(text:, classes: []) ⇒ DropdownHeaderComponent
Returns a new instance of DropdownHeaderComponent.
8 9 10 11 12 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_header_component.rb', line 8 def initialize(text:, classes: []) @text = text @classes = classes super() end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
14 15 16 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_header_component.rb', line 14 def text @text end |
Instance Method Details
#call ⇒ Object
16 17 18 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_header_component.rb', line 16 def call tag.span text, class: classes, role: 'heading' end |
#classes ⇒ Object
20 21 22 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_header_component.rb', line 20 def classes merge_classes('dropdown-header', @classes) end |