Module: UI::MenubarSubBehavior
- Included in:
- MenubarSub, MenubarSubComponent
- Defined in:
- app/behaviors/ui/menubar_sub_behavior.rb
Overview
MenubarSubBehavior
Shared behavior for MenubarSub component across ERB, ViewComponent, and Phlex implementations. This is a wrapper for submenus within the menubar menu.
Instance Method Summary collapse
-
#menubar_sub_classes ⇒ Object
Returns combined CSS classes for the submenu wrapper.
-
#menubar_sub_data_attributes ⇒ Object
Returns data attributes for the submenu wrapper.
-
#menubar_sub_html_attributes ⇒ Object
Returns HTML attributes for the submenu wrapper.
Instance Method Details
#menubar_sub_classes ⇒ Object
Returns combined CSS classes for the submenu wrapper
17 18 19 20 21 22 23 |
# File 'app/behaviors/ui/menubar_sub_behavior.rb', line 17 def classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ "relative", classes_value ].compact.join(" ")) end |
#menubar_sub_data_attributes ⇒ Object
Returns data attributes for the submenu wrapper
26 27 28 29 |
# File 'app/behaviors/ui/menubar_sub_behavior.rb', line 26 def attributes_value = respond_to?(:attributes, true) ? attributes : @attributes attributes_value&.fetch(:data, {}) || {} end |
#menubar_sub_html_attributes ⇒ Object
Returns HTML attributes for the submenu wrapper
9 10 11 12 13 14 |
# File 'app/behaviors/ui/menubar_sub_behavior.rb', line 9 def { class: , data: } end |