Module: UI::MenubarLabelBehavior
- Included in:
- MenubarLabel, MenubarLabelComponent
- Defined in:
- app/behaviors/ui/menubar_label_behavior.rb
Overview
MenubarLabelBehavior
Shared behavior for MenubarLabel component across ERB, ViewComponent, and Phlex implementations.
Instance Method Summary collapse
-
#menubar_label_classes ⇒ Object
Returns combined CSS classes for the label.
-
#menubar_label_data_attributes ⇒ Object
Returns data attributes for the label.
-
#menubar_label_html_attributes ⇒ Object
Returns HTML attributes for the label.
Instance Method Details
#menubar_label_classes ⇒ Object
Returns combined CSS classes for the label
16 17 18 19 20 21 22 23 24 25 |
# File 'app/behaviors/ui/menubar_label_behavior.rb', line 16 def classes_value = respond_to?(:classes, true) ? classes : @classes inset_class = inset? ? "pl-8" : "" TailwindMerge::Merger.new.merge([ "px-2 py-1.5 text-sm font-medium", inset_class, classes_value ].compact.join(" ")) end |
#menubar_label_data_attributes ⇒ Object
Returns data attributes for the label
28 29 30 31 32 33 34 |
# File 'app/behaviors/ui/menubar_label_behavior.rb', line 28 def attributes_value = respond_to?(:attributes, true) ? attributes : @attributes base_data = {} base_data[:inset] = "" if inset? (attributes_value&.fetch(:data, {}) || {}).merge(base_data) end |
#menubar_label_html_attributes ⇒ Object
Returns HTML attributes for the label
8 9 10 11 12 13 |
# File 'app/behaviors/ui/menubar_label_behavior.rb', line 8 def { class: , data: } end |