Class: Keystone::Ui::NavItemComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::NavItemComponent
- Defined in:
- app/components/keystone/ui/nav_item_component.rb
Constant Summary collapse
- ACTIVE_CLASS =
"active"
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
-
#initialize(label:, href:, active: false) ⇒ NavItemComponent
constructor
A new instance of NavItemComponent.
- #link_classes ⇒ Object
Constructor Details
#initialize(label:, href:, active: false) ⇒ NavItemComponent
Returns a new instance of NavItemComponent.
8 9 10 11 12 |
# File 'app/components/keystone/ui/nav_item_component.rb', line 8 def initialize(label:, href:, active: false) @label = label @href = href @active = active end |
Instance Attribute Details
#href ⇒ Object (readonly)
Returns the value of attribute href.
6 7 8 |
# File 'app/components/keystone/ui/nav_item_component.rb', line 6 def href @href end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
6 7 8 |
# File 'app/components/keystone/ui/nav_item_component.rb', line 6 def label @label end |
Instance Method Details
#link_classes ⇒ Object
16 17 18 |
# File 'app/components/keystone/ui/nav_item_component.rb', line 16 def link_classes @active ? ACTIVE_CLASS : "" end |