Class: Railsboot::Stepper::ItemComponent

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

Instance Method Summary collapse

Constructor Details

#initialize(text: '', active: false, tag: 'li', **html_attributes) ⇒ ItemComponent

Returns a new instance of ItemComponent.



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/components/railsboot/stepper/item_component.rb', line 2

def initialize(text: '', active: false, tag: 'li', **html_attributes)
  super()
  @text = text
  @active = active
  @tag = tag
  @html_attributes = html_attributes

  @html_attributes[:class] = class_names(
    'stepper-item',
    { 'active' => @active },
    html_attributes.delete(:class)
  )
end

Instance Method Details

#callObject



16
17
18
# File 'app/components/railsboot/stepper/item_component.rb', line 16

def call
  render(Railsboot::BaseComponent.new(tag: @tag, **@html_attributes)) { content }
end