17 lines
1 KiB
Text
17 lines
1 KiB
Text
- flash_container_no_margin = local_assigns.fetch(:flash_container_no_margin, false)
|
|
- flash_container_class = ('flash-container-no-margin' if flash_container_no_margin)
|
|
|
|
-# We currently only support `alert`, `notice`, `success`, `warning`, 'toast', and 'raw'
|
|
- type_to_variant = {'alert' => 'danger', 'notice' => 'info', 'success' => 'success', 'warning' => 'warning'}
|
|
- closable = %w[alert notice success]
|
|
.flash-container.flash-container-page.sticky{ data: { qa_selector: 'flash_container' }, class: flash_container_class }
|
|
- flash.each do |key, value|
|
|
- if key == 'toast' && value
|
|
.js-toast-message{ data: { message: value } }
|
|
- elsif key == 'raw' && value
|
|
= value
|
|
- elsif value == I18n.t('devise.failure.unconfirmed')
|
|
= render 'shared/confirm_your_email_alert'
|
|
- elsif value
|
|
= render Pajamas::AlertComponent.new(variant: type_to_variant[key], dismissible: closable.include?(key), alert_options: {class: "flash-#{key}", data: { testid: "alert-#{type_to_variant[key]}" }}) do |c|
|
|
= c.with_body { value }
|