Class: Yattho::Beta::Flash
- Defined in:
- app/components/yattho/beta/flash.rb
Overview
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
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
Constructor Details
#initialize(full: false, spacious: false, dismissible: false, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments) ⇒ Flash
Returns a new instance of Flash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/components/yattho/beta/flash.rb', line 56 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 |