Class: StompBase::Ui::ActionCardComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- StompBase::Ui::ActionCardComponent
- Defined in:
- app/components/stomp_base/ui/action_card_component.rb
Instance Method Summary collapse
-
#initialize(card_content:, action:, display_options:) ⇒ ActionCardComponent
constructor
A new instance of ActionCardComponent.
- #show_status? ⇒ Boolean
- #status_indicator_class ⇒ Object
Methods inherited from BaseComponent
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 = [:gradient_colors] @status = [:status] @status_text = [:status_text] end |
Instance Method Details
#show_status? ⇒ 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_class ⇒ Object
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 |