Method: Primer::OpenProject::PageHeader::Dialog#initialize

Defined in:
app/components/primer/open_project/page_header/dialog.rb

#initialize(dialog_arguments: {}, button_arguments: {}) ⇒ Dialog

Returns a new instance of Dialog.

Parameters:

  • dialog_arguments (Hash) (defaults to: {})

    The arguments accepted by <%= link_to_component(Primer::Alpha::Dialog) %>.

  • button_arguments (Hash) (defaults to: {})

    The arguments accepted by <%= link_to_component(Primer::Beta::Button) %> or <%= link_to_component(Primer::Beta::IconButton) %>, depending on the value of the ‘icon:` argument.

[View source]

13
14
15
16
17
18
19
20
# File 'app/components/primer/open_project/page_header/dialog.rb', line 13

def initialize(dialog_arguments: {}, button_arguments: {})
  callback = button_arguments.delete(:button_block)

  @dialog = Primer::Alpha::Dialog.new(**dialog_arguments)
  @button = @dialog.with_show_button(**button_arguments) do |button|
    callback&.call(button)
  end
end