Class: PhlexUI::Command::DialogContent

Inherits:
Base
  • Object
show all
Defined in:
lib/phlex_ui/command/dialog_content.rb

Constant Summary collapse

SIZES =
{
  xs: "max-w-sm",
  sm: "max-w-md",
  md: "max-w-lg",
  lg: "max-w-2xl",
  xl: "max-w-4xl",
  full: "max-w-full"
}

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#before_template

Constructor Details

#initialize(size: :md, **attrs) ⇒ DialogContent

Returns a new instance of DialogContent.



14
15
16
17
# File 'lib/phlex_ui/command/dialog_content.rb', line 14

def initialize(size: :md, **attrs)
  @size = size
  super(**attrs)
end

Instance Method Details

#view_template(&block) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/phlex_ui/command/dialog_content.rb', line 19

def view_template(&block)
  template_tag(data: {dialog_target: "content"}) do
    div(data: {controller: "dismissable"}) do
      backdrop
      div(**attrs, &block)
    end
  end
end