Class: MojComponent::SubNavigationComponent::NavigationItem
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- MojComponent::SubNavigationComponent::NavigationItem
- Defined in:
- app/components/moj_component/sub_navigation_component.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text:, href: "#", current: nil) ⇒ NavigationItem
constructor
A new instance of NavigationItem.
Constructor Details
#initialize(text:, href: "#", current: nil) ⇒ NavigationItem
Returns a new instance of NavigationItem.
10 11 12 13 14 15 |
# File 'app/components/moj_component/sub_navigation_component.rb', line 10 def initialize(text:, href: "#", current: nil) @text = text @href = href @current = current super() end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
8 9 10 |
# File 'app/components/moj_component/sub_navigation_component.rb', line 8 def current @current end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
8 9 10 |
# File 'app/components/moj_component/sub_navigation_component.rb', line 8 def href @href end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
8 9 10 |
# File 'app/components/moj_component/sub_navigation_component.rb', line 8 def text @text end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 |
# File 'app/components/moj_component/sub_navigation_component.rb', line 17 def call tag.li class: "moj-sub-navigation__item" do link_to(text, href, class: "moj-sub-navigation__link", aria: current_override) end end |