Class: Railsboot::StepperComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/stepper_component.rb

Overview

ViewComponent: renders the stepper block.

Constant Summary collapse

ALIGNMENTS =

Alignments.

%w[vertical horizontal].freeze
DEFAULT_ALIGNMENT =

Default alignment.

"vertical".freeze

Instance Method Summary collapse

Constructor Details

#initialize(alignment: DEFAULT_ALIGNMENT, tag: "ol", **html_attributes) ⇒ StepperComponent

Returns a new instance of StepperComponent.



11
12
13
14
15
16
17
18
19
20
21
# File 'app/components/railsboot/stepper_component.rb', line 11

def initialize(alignment: DEFAULT_ALIGNMENT, tag: "ol", **html_attributes)
  @tag = tag
  @alignment = fetch_or_raise(alignment, ALIGNMENTS)
  @html_attributes = html_attributes

  @html_attributes[:class] = class_names(
    "stepper",
    { "stepper-#{@alignment}" => @alignment.to_s == "horizontal" },
    html_attributes[:class]
  )
end