Class: PhlexKit::DialogClose

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/dialog/dialog_close.rb

Overview

Wraps any element (typically a Button) so clicking it dismisses the enclosing dialog, mirroring shadcn/ui's DialogClose. See dialog.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ DialogClose

Returns a new instance of DialogClose.



5
6
7
# File 'app/components/phlex_kit/dialog/dialog_close.rb', line 5

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_templateObject



9
10
11
# File 'app/components/phlex_kit/dialog/dialog_close.rb', line 9

def view_template(&)
  span(**mix({ style: "display: contents", data: { action: "click->phlex-kit--dialog#dismiss" } }, @attrs), &)
end