Class: ElementComponent::Components::ModalHeader

Inherits:
Element
  • Object
show all
Defined in:
lib/element_component/components/modal/header.rb

Instance Attribute Summary

Attributes inherited from Element

#attributes, #contents, #element, #html

Instance Method Summary collapse

Methods inherited from Element

#add_attribute, #add_attribute!, #add_content, #add_content!, #new_element, #remove_attribute, #remove_attribute_value, #render, #reset_attributes!, #reset_contents!

Constructor Details

#initialize(close_button: true, **attributes, &block) ⇒ ModalHeader

Returns a new instance of ModalHeader.



6
7
8
9
10
11
12
13
# File 'lib/element_component/components/modal/header.rb', line 6

def initialize(close_button: true, **attributes, &block)
  super("div", &block)

  add_attribute(class: "modal-header")
  add_attribute(attributes) unless attributes.empty?

  add_content(CloseButton.new) if close_button
end