Class: PandaCms::Admin::FlashMessageComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- PandaCms::Admin::FlashMessageComponent
- Defined in:
- app/components/panda_cms/admin/flash_message_component.rb
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #icon_css ⇒ Object
-
#initialize(message:, kind:) ⇒ FlashMessageComponent
constructor
A new instance of FlashMessageComponent.
- #text_colour_css ⇒ Object
Constructor Details
#initialize(message:, kind:) ⇒ FlashMessageComponent
Returns a new instance of FlashMessageComponent.
8 9 10 11 |
# File 'app/components/panda_cms/admin/flash_message_component.rb', line 8 def initialize(message:, kind:) @kind = kind.to_sym @message = end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
6 7 8 |
# File 'app/components/panda_cms/admin/flash_message_component.rb', line 6 def kind @kind end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'app/components/panda_cms/admin/flash_message_component.rb', line 6 def @message end |
Instance Method Details
#icon_css ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/components/panda_cms/admin/flash_message_component.rb', line 28 def icon_css case kind when :success "fa-circle-check" when :alert "fa-circle-xmark" when :warning "fa-triangle-exclamation" when :info, :notice "fa-circle-info" else "fa-circle-info" end end |
#text_colour_css ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/components/panda_cms/admin/flash_message_component.rb', line 13 def text_colour_css case kind when :success "text-active" when :alert, :error "text-error" when :warning "text-warning" when :info, :notice "text-active" else "text-mid" end end |