Class: Charming::Components::CommandPaletteModal

Inherits:
Charming::Component show all
Defined in:
lib/charming/presentation/components/command_palette_modal.rb

Overview

CommandPaletteModal wraps command palette content in the framework’s standard modal chrome.

Constant Summary collapse

DEFAULT_TITLE =
"Command palette"
DEFAULT_HELP =
"Type to filter. Enter selects. Escape closes."
DEFAULT_WIDTH =
52

Instance Method Summary collapse

Methods inherited from View

#focused?, #layout_assigns

Constructor Details

#initialize(content:, title: DEFAULT_TITLE, help: DEFAULT_HELP, width: DEFAULT_WIDTH, style: nil, theme: nil) ⇒ CommandPaletteModal

Returns a new instance of CommandPaletteModal.



11
12
13
14
15
16
17
18
# File 'lib/charming/presentation/components/command_palette_modal.rb', line 11

def initialize(content:, title: DEFAULT_TITLE, help: DEFAULT_HELP, width: DEFAULT_WIDTH, style: nil, theme: nil)
  super(theme: theme)
  @content = content
  @title = title
  @help = help
  @width = width
  @style = style
end

Instance Method Details

#renderObject



20
21
22
# File 'lib/charming/presentation/components/command_palette_modal.rb', line 20

def render
  render_component Modal.new(content: content, title: title, help: help, width: width, style: modal_style, theme: theme)
end