Class: StimulusPlumbers::Components::List::Section
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::List::Section
- Defined in:
- lib/stimulus_plumbers/components/list/section.rb
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
-
#initialize(template, heading_level: nil) ⇒ Section
constructor
A new instance of Section.
- #item(content = nil, **kwargs, &block) ⇒ Object
- #render(title: nil, description: nil, **kwargs, &block) ⇒ Object
- #section ⇒ Object
Methods inherited from Plumber::Base
Methods included from Plumber::Renderer
#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?
Methods included from Plumber::Options::Aria
Methods included from Plumber::Options::Html
Constructor Details
#initialize(template, heading_level: nil) ⇒ Section
Returns a new instance of Section.
7 8 9 10 |
# File 'lib/stimulus_plumbers/components/list/section.rb', line 7 def initialize(template, heading_level: nil) super(template) @heading_level = heading_level end |
Instance Method Details
#item(content = nil, **kwargs, &block) ⇒ Object
28 29 30 |
# File 'lib/stimulus_plumbers/components/list/section.rb', line 28 def item(content = nil, **kwargs, &block) List::Item.new(template).render(content, **kwargs, &block) end |
#render(title: nil, description: nil, **kwargs, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/stimulus_plumbers/components/list/section.rb', line 12 def render(title: nil, description: nil, **kwargs, &block) = (theme.resolve(:list_section), kwargs) template.content_tag(:li, **) do template.safe_join( [ render_section_header(title, description), render_section_body(title, &block) ] ) end end |