Class: Railsboot::StepperComponent

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

Constant Summary collapse

ALIGNMENTS =
["vertical", "horizontal"].freeze
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.



7
8
9
10
11
12
13
14
15
16
17
# File 'app/components/railsboot/stepper_component.rb', line 7

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