Class: AblyUi::Core::Notice

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
lib/ably_ui/core/notice/notice.rb

Instance Method Summary collapse

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_colorObject



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

Returns:

  • (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_colorObject



16
17
18
# File 'lib/ably_ui/core/notice/notice.rb', line 16

def text_color
  @contents[:text_color] || 'text-white'
end