Class: UI::AlertDialogCancel

Inherits:
Phlex::HTML
  • Object
show all
Includes:
AlertDialogCancelBehavior
Defined in:
app/components/ui/alert_dialog_cancel.rb

Overview

Cancel - Phlex implementation

Cancel button for the alert dialog. Wraps the Button component with alert dialog close action.

Examples:

Basic usage

render UI::Cancel.new { "Cancel" }

Instance Method Summary collapse

Methods included from AlertDialogCancelBehavior

#alert_dialog_cancel_button_data_attributes, #alert_dialog_cancel_data_attributes, #merged_alert_dialog_cancel_data_attributes

Constructor Details

#initialize(variant: :outline, size: :default, classes: "", **attributes) ⇒ AlertDialogCancel

Returns a new instance of AlertDialogCancel.

Parameters:

  • variant (String, Symbol) (defaults to: :outline)

    Button variant

  • size (String, Symbol) (defaults to: :default)

    Button size

  • classes (String) (defaults to: "")

    Additional CSS classes to merge

  • attributes (Hash)

    Additional HTML attributes



17
18
19
20
21
22
# File 'app/components/ui/alert_dialog_cancel.rb', line 17

def initialize(variant: :outline, size: :default, classes: "", **attributes)
  @variant = variant
  @size = size
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#view_template(&block) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'app/components/ui/alert_dialog_cancel.rb', line 24

def view_template(&block)
  render UI::Button.new(
    variant: @variant,
    size: @size,
    classes: @classes,
    **alert_dialog_cancel_button_data_attributes.merge(@attributes)
  ) do
    yield if block_given?
  end
end