Class: Warped::Emails::Stepper
- Defined in:
- lib/warped/emails/components/stepper.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(steps:, current_step: 1) ⇒ Stepper
constructor
A new instance of Stepper.
- #template ⇒ Object
Methods inherited from Base
#content, #helpers, #render_in
Methods included from Styleable
#base_styles, #default_variants, included, #style, #variants
Methods included from Slottable
Constructor Details
#initialize(steps:, current_step: 1) ⇒ Stepper
Returns a new instance of Stepper.
44 45 46 47 48 |
# File 'lib/warped/emails/components/stepper.rb', line 44 def initialize(steps:, current_step: 1) super() @steps = steps @current_step = current_step end |
Instance Method Details
#template ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/warped/emails/components/stepper.rb', line 50 def template tag.div(style: "width: 100%") do capture do (1..steps).map do |step| if step <= current_step concat step(step, state: :active) else concat step(step, state: :inactive) end if step < steps concat divider(state: step <= current_step ? :active : :inactive) end end end end end |