Class: MojComponent::HeaderComponent::NavigationItem
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- MojComponent::HeaderComponent::NavigationItem
- Defined in:
- app/components/moj_component/header_component.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text:, href: nil, current: nil, options: {}) ⇒ NavigationItem
constructor
A new instance of NavigationItem.
Constructor Details
#initialize(text:, href: nil, current: nil, options: {}) ⇒ NavigationItem
Returns a new instance of NavigationItem.
22 23 24 25 26 27 28 |
# File 'app/components/moj_component/header_component.rb', line 22 def initialize(text:, href: nil, current: nil, options: {}) @text = text @href = href @current = current @options = super() end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
20 21 22 |
# File 'app/components/moj_component/header_component.rb', line 20 def current @current end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
20 21 22 |
# File 'app/components/moj_component/header_component.rb', line 20 def href @href end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'app/components/moj_component/header_component.rb', line 20 def @options end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
20 21 22 |
# File 'app/components/moj_component/header_component.rb', line 20 def text @text end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 |
# File 'app/components/moj_component/header_component.rb', line 30 def call tag.li class: "moj-header__navigation-item" do link_to(text, href, class: "moj-header__navigation-link", aria: current_override, **) end end |