Class: Primer::Beta::Flash
- Defined in:
- app/components/primer/beta/flash.rb
Overview
This component has been deprecated. Use [Banner](<%= link_to_component(Primer::Alpha::Banner) %>) instead.
Use ‘Flash` to inform users of successful or pending actions.
Constant Summary collapse
- DEFAULT_SCHEME =
:default
- SCHEME_MAPPINGS =
{ DEFAULT_SCHEME => "", :warning => "flash-warn", :danger => "flash-error", :success => "flash-success" }.freeze
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(full: false, spacious: false, dismissible: false, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments) ⇒ Flash
constructor
A new instance of Flash.
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(full: false, spacious: false, dismissible: false, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments) ⇒ Flash
Returns a new instance of Flash.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/components/primer/beta/flash.rb', line 36 def initialize(full: false, spacious: false, dismissible: false, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments) @icon = icon @dismissible = dismissible @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( @system_arguments[:classes], "flash", SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, DEFAULT_SCHEME)], "flash-full": full ) @system_arguments[:mb] ||= spacious ? 4 : nil end |