Class: JetUi::Stepper::StepComponent

Inherits:
BaseComponent
  • Object
show all
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

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, **options)
  @text        = text
  @status      = STATUSES.include?(status) ? status : DEFAULT_STATUS
  @number      = number
  @icon        = icon
  @description = description
  @url         = url
  @options     = options
end

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
# File 'app/components/jet_ui/stepper/step_component.rb', line 19

def call
   :li, class: item_classes, **@options do
    if @url && @status != :pending
      (:a, href: @url, class: 'stepper__link') { inner_content }
    else
      inner_content
    end
  end
end