Class: DesignSystem::Generic::AlertComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/design_system/generic/alert_component.rb

Overview

Error-summary alert rendered by ds_alert. Content comes from the message argument or a block.

Instance Method Summary collapse

Methods included from Helpers::CssHelper

#css_class_options_merge

Methods included from BrandDerivable

#brand

Constructor Details

#initialize(message = nil) ⇒ AlertComponent

Returns a new instance of AlertComponent.



6
7
8
9
# File 'app/components/design_system/generic/alert_component.rb', line 6

def initialize(message = nil)
  super()
  @message = message
end

Instance Method Details

#callObject



11
12
13
14
15
16
# File 'app/components/design_system/generic/alert_component.rb', line 11

def call
  (:div, class: "#{brand}-error-summary", 'aria-labelledby': 'error-summary-title',
                    role: 'alert', tabindex: '-1') do
    (:h2, body, class: "#{brand}-error-summary__title", id: 'error-summary-title')
  end
end