Class: PhlexKit::AlertDialogContent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::AlertDialogContent
- Defined in:
- app/components/phlex_kit/alert_dialog/alert_dialog_content.rb
Overview
The modal body, held in a and cloned into on open. The
cloned div carries its own phlex-kit--alert-dialog controller so Cancel
(#dismiss) can remove it. Holds Header + Footer. See alert_dialog.rb.
Constant Summary collapse
- SIZES =
size => panel modifier; :sm is shadcn's compact variant.
{ default: nil, sm: "sm" }.freeze
Instance Method Summary collapse
-
#initialize(size: :default, **attrs) ⇒ AlertDialogContent
constructor
A new instance of AlertDialogContent.
- #view_template(&block) ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(size: :default, **attrs) ⇒ AlertDialogContent
Returns a new instance of AlertDialogContent.
9 10 11 12 |
# File 'app/components/phlex_kit/alert_dialog/alert_dialog_content.rb', line 9 def initialize(size: :default, **attrs) @size = size.to_sym @attrs = attrs end |
Instance Method Details
#view_template(&block) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/components/phlex_kit/alert_dialog/alert_dialog_content.rb', line 14 def view_template(&block) template(**mix({ data: { phlex_kit__alert_dialog_target: "content" } }, @attrs)) do div(data: { controller: "phlex-kit--alert-dialog" }) do div(class: "pk-alert-dialog-overlay", "aria-hidden": "true") div(role: "alertdialog", "aria-modal": "true", class: [ "pk-alert-dialog-panel", fetch_option(SIZES, @size, :size) ].compact.join(" "), &block) end end end |