Class: JetUi::Stepper::StepComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- JetUi::Stepper::StepComponent
- Defined in:
- app/components/jet_ui/stepper/step_component.rb
Constant Summary collapse
- STATUSES =
%i[pending current completed].freeze
- DEFAULT_STATUS =
:pending
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text = nil, status: DEFAULT_STATUS, number: nil, icon: nil, description: nil, url: nil, **options) ⇒ StepComponent
constructor
A new instance of StepComponent.
Constructor Details
#initialize(text = nil, status: DEFAULT_STATUS, number: nil, icon: nil, description: nil, url: nil, **options) ⇒ StepComponent
Returns a new instance of StepComponent.
9 10 11 12 13 14 15 16 17 |
# File 'app/components/jet_ui/stepper/step_component.rb', line 9 def initialize(text = nil, status: DEFAULT_STATUS, number: nil, icon: nil, description: nil, url: nil, **) @text = text @status = STATUSES.include?(status) ? status : DEFAULT_STATUS @number = number @icon = icon @description = description @url = url @options = end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/components/jet_ui/stepper/step_component.rb', line 19 def call content_tag :li, class: item_classes, **@options do if @url && @status != :pending content_tag(:a, href: @url, class: 'stepper__link') { inner_content } else inner_content end end end |