Class: Railsboot::Stepper::ItemComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::Stepper::ItemComponent
- Defined in:
- app/components/railsboot/stepper/item_component.rb
Overview
ViewComponent: renders the item block.
Instance Method Summary collapse
-
#call ⇒ String
Renders the stepper item element with its content.
-
#initialize(text: '', active: false, tag: 'li', **html_attributes) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
Constructor Details
#initialize(text: '', active: false, tag: 'li', **html_attributes) ⇒ ItemComponent
Returns a new instance of ItemComponent.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/components/railsboot/stepper/item_component.rb', line 9 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
#call ⇒ String
Renders the stepper item element with its content.
25 26 27 |
# File 'app/components/railsboot/stepper/item_component.rb', line 25 def call render(Railsboot::BaseComponent.new(tag: @tag, **@html_attributes)) { content } end |