Class: Satis::FlashMessages::Message
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Satis::FlashMessages::Message
- Defined in:
- app/components/satis/flash_messages/component.rb
Instance Attribute Summary collapse
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Attributes inherited from ApplicationComponent
Instance Method Summary collapse
- #color_class ⇒ Object
-
#initialize(message:, level: :alert, icon: nil) ⇒ Message
constructor
A new instance of Message.
Methods inherited from ApplicationComponent
Constructor Details
#initialize(message:, level: :alert, icon: nil) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 13 |
# File 'app/components/satis/flash_messages/component.rb', line 8 def initialize(message:, level: :alert, icon: nil) super @message = @level = level @icon = icon end |
Instance Attribute Details
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
6 7 8 |
# File 'app/components/satis/flash_messages/component.rb', line 6 def icon @icon end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
6 7 8 |
# File 'app/components/satis/flash_messages/component.rb', line 6 def level @level end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'app/components/satis/flash_messages/component.rb', line 6 def @message end |
Instance Method Details
#color_class ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/components/satis/flash_messages/component.rb', line 15 def color_class case level.to_sym when :alert :'bg-red-500' when :notice :'bg-green-500' else :'bg-yellow-500' end end |