Class: StompBase::Ui::ActionCardComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/stomp_base/ui/action_card_component.rb

Instance Method Summary collapse

Methods inherited from BaseComponent

#call, #render?

Constructor Details

#initialize(card_content:, action:, display_options:) ⇒ ActionCardComponent

Returns a new instance of ActionCardComponent.



6
7
8
9
10
11
12
13
14
15
16
# File 'app/components/stomp_base/ui/action_card_component.rb', line 6

def initialize(card_content:, action:, display_options:)
  super()
  @title = card_content[:title]
  @description = card_content[:description]
  @action_text = action[:text]
  @action_url = action[:url]
  @icon = card_content[:icon]
  @gradient_colors = display_options[:gradient_colors]
  @status = display_options[:status]
  @status_text = display_options[:status_text]
end

Instance Method Details

#show_status?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/components/stomp_base/ui/action_card_component.rb', line 18

def show_status?
  @status.present? && @status_text.present?
end

#status_indicator_classObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/components/stomp_base/ui/action_card_component.rb', line 22

def status_indicator_class
  case @status
  when :active
    "status-active"
  when :warning
    "status-warning"
  when :error
    "status-error"
  else
    "status-inactive"
  end
end