Class: Shadcn::BreadcrumbItemComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/breadcrumb_item_component.rb

Overview

Individual breadcrumb item

Constant Summary collapse

"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

Methods inherited from BaseComponent

#content

Methods included from Rails::Helpers::ClassNameHelper

#cn

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, **options)
  super(class_name: class_name, **options)
  @href = href
  @current = current
  @class_name = class_name
end

Instance Method Details

#callObject



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
    (:span, item_attributes) do
      content
    end
  else
    (:a, link_attributes) do
      content
    end
  end
end