Class: LightningUiKit::Breadcrumb::ItemComponent

Inherits:
LightningUiKit::BaseComponent
  • Object
show all
Defined in:
app/components/lightning_ui_kit/breadcrumb/item_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href: nil, current: false, **options) ⇒ ItemComponent

Returns a new instance of ItemComponent.



2
3
4
5
6
# File 'app/components/lightning_ui_kit/breadcrumb/item_component.rb', line 2

def initialize(href: nil, current: false, **options)
  @href = href
  @current = current
  @options = options
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



26
27
28
# File 'app/components/lightning_ui_kit/breadcrumb/item_component.rb', line 26

def href
  @href
end

Instance Method Details

#current_classesObject



19
20
21
22
23
24
# File 'app/components/lightning_ui_kit/breadcrumb/item_component.rb', line 19

def current_classes
  merge_classes([
    "lui:font-normal lui:text-foreground",
    @options[:class]
  ].compact.join(" "))
end

#link?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/components/lightning_ui_kit/breadcrumb/item_component.rb', line 8

def link?
  !@current && @href.present?
end


12
13
14
15
16
17
# File 'app/components/lightning_ui_kit/breadcrumb/item_component.rb', line 12

def link_classes
  merge_classes([
    "lui:transition-colors lui:hover:text-foreground",
    @options[:class]
  ].compact.join(" "))
end