Class: RUI::Slideout

Inherits:
Base
  • Object
show all
Includes:
Phlex::Rails::Helpers::TurboFrameTag
Defined in:
lib/rui/slideout.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from RUI::Base

Instance Method Details

#view_templateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rui/slideout.rb', line 6

def view_template(&)
  turbo_frame_tag "slideout" do
    div(class: "absolute inset-0 z-50", data: { controller: "slideout" }) do
      a(href: "#", class: "cursor-default", data: { action: "slideout#hide" }) do
        div(id: "modal-curtain", class: "w-screen h-screen bg-black transition-opacity opacity-75", data: { slideout_target: "curtain" })
      end
      div(class: "fixed right-0 inset-y-0 w-1/2 h-full bg-white shadow flex flex-col pointer-events-auto", data: { slideout_target: "slideout" }) do
        div class: "flex-grow flex flex-col gap-3 overflow-y-scroll p-10" do
          div(class: "flex flex-row justify-between items-center") do
            render RUI::Markdown::Safe.new { "## #{@title}" }

            render RUI::Links::Destructive.new(
              href: "#",
              icon: "x",
              data: { action: "slideout#hide" }
            )
          end
          yield
        end
      end
    end
  end
end