Class: UI::MenubarShortcutComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
MenubarShortcutBehavior
Defined in:
app/view_components/ui/menubar_shortcut_component.rb

Overview

ShortcutComponent - ViewComponent implementation

Keyboard shortcut display.

Examples:

Basic usage

render UI::ShortcutComponent.new { "⌘S" }

Instance Method Summary collapse

Methods included from MenubarShortcutBehavior

#menubar_shortcut_classes, #menubar_shortcut_data_attributes, #menubar_shortcut_html_attributes

Constructor Details

#initialize(classes: "", **attributes) ⇒ MenubarShortcutComponent

Returns a new instance of MenubarShortcutComponent.



12
13
14
15
# File 'app/view_components/ui/menubar_shortcut_component.rb', line 12

def initialize(classes: "", **attributes)
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



17
18
19
20
21
# File 'app/view_components/ui/menubar_shortcut_component.rb', line 17

def call
   :span, **menubar_shortcut_html_attributes.deep_merge(@attributes) do
    content
  end
end