Class: PhlexUI::Dialog::Content

Inherits:
Base
  • Object
show all
Defined in:
lib/phlex_ui/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) ⇒ Content

Returns a new instance of Content.



14
15
16
17
# File 'lib/phlex_ui/dialog/content.rb', line 14

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

Instance Method Details

#view_templateObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/phlex_ui/dialog/content.rb', line 19

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