Class: DocsKit::NavItem
- Inherits:
-
Data
- Object
- Data
- DocsKit::NavItem
- Defined in:
- lib/docs_kit/nav_item.rb
Overview
A single sidebar link. Sites map their own registries (Doc, Demo, ComponentDoc, ...) to NavItems in the nav callable, so the Sidebar stays registry-agnostic:
c.nav = -> {
{
"Demos" => Demo.grouped.transform_values { |demos|
demos.map { |d| DocsKit::NavItem.new(href: demo_path(d.slug), label: d.title, icon: d.icon) }
},
}
}
The Sidebar renders #label at #href, with an optional lucide #icon.
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
-
#initialize(href:, label:, icon: nil) ⇒ NavItem
constructor
A new instance of NavItem.
Constructor Details
#initialize(href:, label:, icon: nil) ⇒ NavItem
Returns a new instance of NavItem.
18 19 20 |
# File 'lib/docs_kit/nav_item.rb', line 18 def initialize(href:, label:, icon: nil) super end |
Instance Attribute Details
#href ⇒ Object (readonly)
Returns the value of attribute href
17 18 19 |
# File 'lib/docs_kit/nav_item.rb', line 17 def href @href end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon
17 18 19 |
# File 'lib/docs_kit/nav_item.rb', line 17 def icon @icon end |
#label ⇒ Object (readonly)
Returns the value of attribute label
17 18 19 |
# File 'lib/docs_kit/nav_item.rb', line 17 def label @label end |