Class: JetUi::Breadcrumbs::ItemComponent
- Inherits:
-
JetUi::BaseComponent
- Object
- ViewComponent::Base
- JetUi::BaseComponent
- JetUi::Breadcrumbs::ItemComponent
- Defined in:
- app/components/jet_ui/breadcrumbs/item_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label = nil, href: nil, **options) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
Constructor Details
#initialize(label = nil, href: nil, **options) ⇒ ItemComponent
Returns a new instance of ItemComponent.
6 7 8 9 10 |
# File 'app/components/jet_ui/breadcrumbs/item_component.rb', line 6 def initialize(label = nil, href: nil, **) @label = label @href = href @options = end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/jet_ui/breadcrumbs/item_component.rb', line 12 def call content_tag :li, class: 'breadcrumbs__item' do text = @label.presence || content if @href link_to text, @href, class: class_names('breadcrumbs__link', @options.delete(:class)), **@options else content_tag :span, text, class: class_names('breadcrumbs__current', @options.delete(:class)), 'aria-current': 'page', **@options end end end |