Class: SolidWebUi::Ui::StatusBadgeComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- SolidWebUi::Ui::StatusBadgeComponent
- 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
- #call ⇒ Object
-
#initialize(label:, status: nil) ⇒ StatusBadgeComponent
constructor
A new instance of StatusBadgeComponent.
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
#call ⇒ Object
26 27 28 |
# File 'app/components/solid_web_ui/ui/status_badge_component.rb', line 26 def call content_tag(:span, @label, class: "swui-badge swui-badge--#{tone}") end |