Class: AblyUi::Core::Notice
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- AblyUi::Core::Notice
- Defined in:
- lib/ably_ui/core/notice/notice.rb
Instance Method Summary collapse
- #bg_color ⇒ Object
- #close_btn? ⇒ Boolean
- #content_wrapper(*args, &block) ⇒ Object
-
#initialize(contents) ⇒ Notice
constructor
A new instance of Notice.
- #text_color ⇒ Object
Constructor Details
#initialize(contents) ⇒ Notice
Returns a new instance of Notice.
4 5 6 |
# File 'lib/ably_ui/core/notice/notice.rb', line 4 def initialize(contents) @contents = contents end |
Instance Method Details
#bg_color ⇒ Object
12 13 14 |
# File 'lib/ably_ui/core/notice/notice.rb', line 12 def bg_color @contents[:bg_color] || 'bg-gradient-active-orange' end |
#close_btn? ⇒ Boolean
8 9 10 |
# File 'lib/ably_ui/core/notice/notice.rb', line 8 def close_btn? @contents[:close_btn] end |
#content_wrapper(*args, &block) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/ably_ui/core/notice/notice.rb', line 20 def content_wrapper(*args, &block) if @contents[:button_link].present? link_to(@contents[:button_link], *args, &block) else tag.div(*args, &block) end end |
#text_color ⇒ Object
16 17 18 |
# File 'lib/ably_ui/core/notice/notice.rb', line 16 def text_color @contents[:text_color] || 'text-white' end |