Class: SolidWebUi::Ui::StatusBadgeComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/solid_web_ui/ui/status_badge_component.rb

Overview

A small pill conveying a record’s status. Maps a domain status symbol to one of the shared tone classes; unknown statuses degrade to a neutral pill.

Constant Summary collapse

TONES =
{
  ready: :info,
  scheduled: :info,
  in_progress: :info,
  claimed: :info,
  finished: :success,
  succeeded: :success,
  failed: :danger,
  blocked: :warning,
  paused: :warning,
  stale: :warning
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(label:, status: nil) ⇒ StatusBadgeComponent

Returns a new instance of StatusBadgeComponent.



21
22
23
24
# File 'app/components/solid_web_ui/ui/status_badge_component.rb', line 21

def initialize(label:, status: nil)
  @label = label
  @status = status
end

Instance Method Details

#callObject



26
27
28
# File 'app/components/solid_web_ui/ui/status_badge_component.rb', line 26

def call
  (:span, @label, class: "swui-badge swui-badge--#{tone}")
end