Class: Keystone::Ui::NavItemComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/keystone/ui/nav_item_component.rb

Constant Summary collapse

ACTIVE_CLASS =
"active"

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hrefObject (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

#labelObject (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



16
17
18
# File 'app/components/keystone/ui/nav_item_component.rb', line 16

def link_classes
  @active ? ACTIVE_CLASS : ""
end