Class: StimulusPlumbers::Components::Timeline::Group

Inherits:
Plumber::Base
  • Object
show all
Defined in:
lib/stimulus_plumbers/components/timeline/group.rb

Instance Attribute Summary

Attributes inherited from Plumber::Base

#template

Instance Method Summary collapse

Methods inherited from Plumber::Base

#initialize, #theme

Methods included from Plumber::Renderer

#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?

Methods included from Plumber::Options::Aria

#labelled_aria

Methods included from Plumber::Options::Html

#merge_html_options

Constructor Details

This class inherits a constructor from StimulusPlumbers::Plumber::Base

Instance Method Details

#render(**kwargs, &block) ⇒ Object



7
8
9
10
11
# File 'lib/stimulus_plumbers/components/timeline/group.rb', line 7

def render(**kwargs, &block)
  content = template.capture(self, &block)
  html_options = merge_html_options(theme.resolve(:timeline_group), kwargs)
  template.(:div, content, **html_options)
end

#section(date:, datetime: nil, **kwargs, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/stimulus_plumbers/components/timeline/group.rb', line 13

def section(date:, datetime: nil, **kwargs, &block)
  inner_tl = Timeline.new(template)
  inner_tl.instance_variable_set(:@orientation, :vertical)
  inner_tl.instance_variable_set(:@interactive, false)

  events_html  = template.capture(inner_tl, &block)
  section_html = template.(:div, **merge_html_options(theme.resolve(:timeline_group_section), kwargs)) do
    render_section_body(date: date, datetime: datetime, events_html: events_html)
  end
  template.concat(section_html)
end