Module: UI::MenubarShortcutBehavior
- Included in:
- MenubarShortcut, MenubarShortcutComponent
- Defined in:
- app/behaviors/ui/menubar_shortcut_behavior.rb
Overview
MenubarShortcutBehavior
Shared behavior for MenubarShortcut component across ERB, ViewComponent, and Phlex implementations.
Instance Method Summary collapse
-
#menubar_shortcut_classes ⇒ Object
Returns combined CSS classes for the shortcut.
-
#menubar_shortcut_data_attributes ⇒ Object
Returns data attributes for the shortcut.
-
#menubar_shortcut_html_attributes ⇒ Object
Returns HTML attributes for the shortcut.
Instance Method Details
#menubar_shortcut_classes ⇒ Object
Returns combined CSS classes for the shortcut
16 17 18 19 20 21 22 |
# File 'app/behaviors/ui/menubar_shortcut_behavior.rb', line 16 def classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ "text-muted-foreground ml-auto text-xs tracking-widest", classes_value ].compact.join(" ")) end |
#menubar_shortcut_data_attributes ⇒ Object
Returns data attributes for the shortcut
25 26 27 28 |
# File 'app/behaviors/ui/menubar_shortcut_behavior.rb', line 25 def attributes_value = respond_to?(:attributes, true) ? attributes : @attributes attributes_value&.fetch(:data, {}) || {} end |
#menubar_shortcut_html_attributes ⇒ Object
Returns HTML attributes for the shortcut
8 9 10 11 12 13 |
# File 'app/behaviors/ui/menubar_shortcut_behavior.rb', line 8 def { class: , data: } end |