Class: Railsboot::Dropdown::LinkComponent

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

Instance Method Summary collapse

Constructor Details

#initialize(text: "", href: "", active: false, disabled: false, **html_attributes) ⇒ LinkComponent

Returns a new instance of LinkComponent.



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/components/railsboot/dropdown/link_component.rb', line 2

def initialize(text: "", href: "", active: false, disabled: false, **html_attributes)
  @text = text
  @href = href
  @active = active
  @disabled = disabled
  @html_attributes = html_attributes

  @html_attributes[:class] = class_names(
    "dropdown-item",
    {"active" => @active},
    {"disabled" => @disabled},
    html_attributes.delete(:class)
  )
end