Class: BetterUi::General::Dropdown::DividerComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- BetterUi::General::Dropdown::DividerComponent
- Defined in:
- app/components/better_ui/general/dropdown/divider_component.rb
Constant Summary collapse
- DROPDOWN_DIVIDER_CLASSES =
Classi base per il divisore del dropdown
"border-t border-gray-100 my-1"
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
Instance Method Summary collapse
-
#divider_attributes ⇒ Object
Restituisce gli attributi per il divisore.
-
#divider_classes ⇒ Object
Combina tutte le classi per il divisore.
-
#initialize(classes: nil, **html_options) ⇒ DividerComponent
constructor
A new instance of DividerComponent.
Constructor Details
#initialize(classes: nil, **html_options) ⇒ DividerComponent
Returns a new instance of DividerComponent.
12 13 14 15 |
# File 'app/components/better_ui/general/dropdown/divider_component.rb', line 12 def initialize(classes: nil, **) @classes = classes @html_options = end |
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
7 8 9 |
# File 'app/components/better_ui/general/dropdown/divider_component.rb', line 7 def classes @classes end |
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
7 8 9 |
# File 'app/components/better_ui/general/dropdown/divider_component.rb', line 7 def @html_options end |
Instance Method Details
#divider_attributes ⇒ Object
Restituisce gli attributi per il divisore
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/components/better_ui/general/dropdown/divider_component.rb', line 26 def divider_attributes attrs = { class: divider_classes, role: "separator" } @html_options.except(:class).each do |key, value| attrs[key] = value end attrs end |
#divider_classes ⇒ Object
Combina tutte le classi per il divisore
18 19 20 21 22 23 |
# File 'app/components/better_ui/general/dropdown/divider_component.rb', line 18 def divider_classes [ DROPDOWN_DIVIDER_CLASSES, @classes ].compact.join(" ") end |