Class: PhlexUI::Sheet::Content
- Defined in:
- lib/phlex_ui/sheet/content.rb
Constant Summary collapse
- SIDE_CLASS =
{ top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", right: "inset-y-0 right-0 h-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right", bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", left: "inset-y-0 left-0 h-full border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left" }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(side: :right, **attrs) ⇒ Content
constructor
A new instance of Content.
- #view_template(&block) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(side: :right, **attrs) ⇒ Content
Returns a new instance of Content.
12 13 14 15 16 |
# File 'lib/phlex_ui/sheet/content.rb', line 12 def initialize(side: :right, **attrs) @side = side @side_classes = SIDE_CLASS[side] super(**attrs) end |
Instance Method Details
#view_template(&block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/phlex_ui/sheet/content.rb', line 18 def view_template(&block) template_tag(data: {sheet_target: "content"}) do div(data: {controller: "dismissable"}) do backdrop div(**attrs) do block&.call end end end end |