Class: PhlexUI::AlertDialog::Content

Inherits:
Base
  • Object
show all
Defined in:
lib/phlex_ui/alert_dialog/content.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#before_template, #initialize

Constructor Details

This class inherits a constructor from PhlexUI::Base

Instance Method Details

#backgroundObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/phlex_ui/alert_dialog/content.rb', line 14

def background
  div(
    data_state: "open",
    class:
          "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
    style: "pointer-events:auto",
    data_aria_hidden: "true",
    aria_hidden: "true"
  )
end

#containerObject



25
26
27
28
29
30
31
32
33
# File 'lib/phlex_ui/alert_dialog/content.rb', line 25

def container(&)
  div(
    role: "alertdialog",
    data_state: "open",
    class: "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",
    style: "pointer-events:auto",
    &
  )
end

#view_template(&block) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/phlex_ui/alert_dialog/content.rb', line 5

def view_template(&block)
  template_tag(**attrs) do
    div(data: {controller: "dismissable"}) do
      background
      container(&block)
    end
  end
end