Class: Keystone::Ui::BottomNavItemComponent

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

Constant Summary collapse

ITEM_BASE =
"bottom-nav-item"
ACTIVE_CLASS =
"active"
LABEL_CLASSES =
"bottom-nav-label"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, href:, icon:, active: false) ⇒ BottomNavItemComponent

Returns a new instance of BottomNavItemComponent.



8
9
10
11
12
13
# File 'app/components/keystone/ui/bottom_nav_item_component.rb', line 8

def initialize(label:, href:, icon:, active: false)
  @label = label
  @href = href
  @icon = icon
  @active = active
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



6
7
8
# File 'app/components/keystone/ui/bottom_nav_item_component.rb', line 6

def href
  @href
end

#iconObject (readonly)

Returns the value of attribute icon.



6
7
8
# File 'app/components/keystone/ui/bottom_nav_item_component.rb', line 6

def icon
  @icon
end

#labelObject (readonly)

Returns the value of attribute label.



6
7
8
# File 'app/components/keystone/ui/bottom_nav_item_component.rb', line 6

def label
  @label
end

Instance Method Details

#item_classesObject



19
20
21
# File 'app/components/keystone/ui/bottom_nav_item_component.rb', line 19

def item_classes
  @active ? "#{ITEM_BASE} #{ACTIVE_CLASS}" : ITEM_BASE
end