Module: Klods::Components::Toc
- Included in:
- Builders
- Defined in:
- lib/klods/components/toc.rb
Instance Method Summary collapse
- #toc(a = nil, b = nil, &block) ⇒ Object
- #toc_item(a = nil, b = nil, &block) ⇒ Object
- #toc_link(a = nil, b = nil, &block) ⇒ Object
Instance Method Details
#toc(a = nil, b = nil, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/klods/components/toc.rb', line 4 def toc(a = nil, b = nil, &block) props, children = Core.normalize_args(a, b) children = klods_capture(&block) if block Core.build( tag: "ul", base: "klods-toc", modifiers: {sub: "klods-toc--sub"}, props: props, children: children ) end |
#toc_item(a = nil, b = nil, &block) ⇒ Object
14 15 16 17 18 |
# File 'lib/klods/components/toc.rb', line 14 def toc_item(a = nil, b = nil, &block) props, children = Core.normalize_args(a, b) children = klods_capture(&block) if block Core.el("li", props, children) end |
#toc_link(a = nil, b = nil, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/klods/components/toc.rb', line 20 def toc_link(a = nil, b = nil, &block) props, children = Core.normalize_args(a, b) children = klods_capture(&block) if block Core.build( tag: "a", base: "klods-toc__link", modifiers: {active: "klods-toc__link--active"}, props: props, children: children ) end |