Class: Railsboot::BreadcrumbComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/breadcrumb_component.rb

Constant Summary

Constants inherited from Component

Component::COLORS, Component::DEFAULT_COLOR

Instance Method Summary collapse

Constructor Details

#initialize(wrapper_attributes: {}, **html_attributes) ⇒ BreadcrumbComponent

Returns a new instance of BreadcrumbComponent.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/components/railsboot/breadcrumb_component.rb', line 4

def initialize(wrapper_attributes: {}, **html_attributes)
  @wrapper_attributes = wrapper_attributes
  @html_attributes = html_attributes

  @html_attributes[:tag] = "nav"
  @html_attributes[:class] = class_names(
    html_attributes.delete(:class)
  ).presence

  @wrapper_attributes[:tag] = "ol"
  @wrapper_attributes[:class] = class_names(
    "breadcrumb",
    wrapper_attributes.delete(:class)
  )
end