Class: Shadcn::BreadcrumbItemComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::BreadcrumbItemComponent
- Defined in:
- app/components/shadcn/breadcrumb_item_component.rb
Overview
Individual breadcrumb item
Constant Summary collapse
- LINK_CLASSES =
"transition-colors hover:text-foreground"- PAGE_CLASSES =
"font-normal text-foreground"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(href: nil, current: false, class_name: nil, **options) ⇒ BreadcrumbItemComponent
constructor
A new instance of BreadcrumbItemComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(href: nil, current: false, class_name: nil, **options) ⇒ BreadcrumbItemComponent
Returns a new instance of BreadcrumbItemComponent.
9 10 11 12 13 14 |
# File 'app/components/shadcn/breadcrumb_item_component.rb', line 9 def initialize(href: nil, current: false, class_name: nil, **) super(class_name: class_name, **) @href = href @current = current @class_name = class_name end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/components/shadcn/breadcrumb_item_component.rb', line 16 def call if @current content_tag(:span, item_attributes) do content end else content_tag(:a, link_attributes) do content end end end |