Class: Railsboot::Stepper::ItemComponent

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

Overview

ViewComponent: renders the item block.

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ItemComponent.



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

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



18
19
20
# File 'app/components/railsboot/stepper/item_component.rb', line 18

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