Class: Primer::BreadcrumbComponent::ItemComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Primer::BreadcrumbComponent::ItemComponent
- Defined in:
- app/components/primer/breadcrumb_component.rb
Overview
This component is part of ‘Primer::BreadcrumbComponent` and should not be used as a standalone component.
Constant Summary
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(href: nil, selected: false, **system_arguments) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Constructor Details
#initialize(href: nil, selected: false, **system_arguments) ⇒ ItemComponent
Returns a new instance of ItemComponent.
36 37 38 39 40 41 42 43 44 |
# File 'app/components/primer/breadcrumb_component.rb', line 36 def initialize(href: nil, selected: false, **system_arguments) @href = href @system_arguments = system_arguments @href = nil if selected @system_arguments[:tag] = :li @system_arguments[:"aria-current"] = "page" if selected @system_arguments[:classes] = "breadcrumb-item #{@system_arguments[:classes]}" end |
Instance Method Details
#call ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'app/components/primer/breadcrumb_component.rb', line 46 def call render(Primer::BaseComponent.new(**@system_arguments)) do if @href.present? render(Primer::LinkComponent.new(href: @href)) { content } else content end end end |