Class: Keystone::Ui::PipelineComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::PipelineComponent
- Defined in:
- app/components/keystone/ui/pipeline_component.rb
Constant Summary collapse
- CONTAINER_CLASSES =
"rounded-xl border border-surface-700 bg-surface-800 p-6"- HEADER_CLASSES =
"mb-4"- TITLE_CLASSES =
"text-lg font-semibold text-white"- SUBTITLE_CLASSES =
"mt-1 text-sm text-surface-400"- TRACK_CLASSES =
"flex flex-col gap-3 sm:flex-row sm:items-stretch"- BOX_CLASSES =
"flex flex-1 flex-col items-center gap-2 rounded-lg border border-surface-700 bg-surface-900 p-4 text-center"- BOX_LABEL_CLASSES =
"text-xs uppercase tracking-wide text-surface-500"- CONNECTOR_CLASSES =
"flex items-center justify-center"- COUNT_BASE_CLASSES =
"text-3xl font-bold"- LINK_BASE_CLASSES =
"link-toggle text-2xl leading-none"- LINK_HEALTHY_CLASSES =
"text-accent-500"- LINK_BROKEN_CLASSES =
"text-red-500"- COUNT_CLASSES =
{ amber: "text-amber-400", emerald: "text-accent-400", danger: "text-red-400", muted: "text-surface-500" }.freeze
Instance Attribute Summary collapse
-
#boxes ⇒ Object
readonly
Returns the value of attribute boxes.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#subtitle ⇒ Object
readonly
Returns the value of attribute subtitle.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #count_class(accent) ⇒ Object
-
#initialize(title:, boxes:, links:, subtitle: nil) ⇒ PipelineComponent
constructor
A new instance of PipelineComponent.
- #link_after(index) ⇒ Object
- #link_classes(link) ⇒ Object
Constructor Details
#initialize(title:, boxes:, links:, subtitle: nil) ⇒ PipelineComponent
Returns a new instance of PipelineComponent.
28 29 30 31 32 33 |
# File 'app/components/keystone/ui/pipeline_component.rb', line 28 def initialize(title:, boxes:, links:, subtitle: nil) @title = title @boxes = boxes @links = links @subtitle = subtitle end |
Instance Attribute Details
#boxes ⇒ Object (readonly)
Returns the value of attribute boxes.
26 27 28 |
# File 'app/components/keystone/ui/pipeline_component.rb', line 26 def boxes @boxes end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
26 27 28 |
# File 'app/components/keystone/ui/pipeline_component.rb', line 26 def links @links end |
#subtitle ⇒ Object (readonly)
Returns the value of attribute subtitle.
26 27 28 |
# File 'app/components/keystone/ui/pipeline_component.rb', line 26 def subtitle @subtitle end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
26 27 28 |
# File 'app/components/keystone/ui/pipeline_component.rb', line 26 def title @title end |
Instance Method Details
#count_class(accent) ⇒ Object
35 36 37 |
# File 'app/components/keystone/ui/pipeline_component.rb', line 35 def count_class(accent) "#{COUNT_BASE_CLASSES} #{COUNT_CLASSES.fetch(accent, COUNT_CLASSES[:muted])}" end |
#link_after(index) ⇒ Object
39 40 41 |
# File 'app/components/keystone/ui/pipeline_component.rb', line 39 def link_after(index) links[index] end |
#link_classes(link) ⇒ Object
43 44 45 |
# File 'app/components/keystone/ui/pipeline_component.rb', line 43 def link_classes(link) "#{LINK_BASE_CLASSES} #{link[:broken] ? LINK_BROKEN_CLASSES : LINK_HEALTHY_CLASSES}" end |