Class: Essence::NotificationComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Essence::NotificationComponent
- Defined in:
- app/components/essence/notification_component.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_VARIANT =
:info- VARIANT_MAPPINGS =
{ :success => 'notification-success', :notice => 'notification-notice', DEFAULT_VARIANT => 'notification-info', :warning => 'notification-warning', :danger => 'notification-danger', :alert => 'notification-danger' }.freeze
- VARIANT_OPTIONS =
VARIANT_MAPPINGS.keys.freeze
- ICON_MAPPINGS =
{ :success => 'circle_check', :notice => 'circle_check', DEFAULT_VARIANT => 'circle_info', :warning => 'circle_exclamation', :danger => 'circle_xmark', :alert => 'circle_xmark' }.freeze
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Attribute Summary collapse
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
Instance Method Summary collapse
-
#initialize(variant: DEFAULT_VARIANT, **html_options) ⇒ NotificationComponent
constructor
A new instance of NotificationComponent.
Methods inherited from ApplicationComponent
Methods included from Utils
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #integer_or_fallback
Constructor Details
#initialize(variant: DEFAULT_VARIANT, **html_options) ⇒ NotificationComponent
Returns a new instance of NotificationComponent.
29 30 31 32 33 |
# File 'app/components/essence/notification_component.rb', line 29 def initialize(variant: DEFAULT_VARIANT, **) @variant = fetch_or_fallback(VARIANT_OPTIONS, variant.to_sym, DEFAULT_VARIANT) = end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
5 6 7 |
# File 'app/components/essence/notification_component.rb', line 5 def end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
5 6 7 |
# File 'app/components/essence/notification_component.rb', line 5 def icon @icon end |