Class: RubyUI::SheetContent
- Defined in:
- lib/ruby_ui/sheet/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" }
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(side: :right, **attrs) ⇒ SheetContent
constructor
A new instance of SheetContent.
- #view_template(&block) ⇒ Object
Constructor Details
#initialize(side: :right, **attrs) ⇒ SheetContent
Returns a new instance of SheetContent.
12 13 14 15 16 |
# File 'lib/ruby_ui/sheet/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/ruby_ui/sheet/sheet_content.rb', line 18 def view_template(&block) template(data: {ruby_ui__sheet_target: "content"}) do div(data: {controller: "ruby-ui--sheet-content"}) do backdrop div(**attrs) do block&.call end end end end |