Class: Irelia::Sidebar::Navigation::Link::Component

Inherits:
Component
  • Object
show all
Defined in:
app/components/irelia/sidebar/navigation/link/component.rb

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Component

Returns a new instance of Component.



21
22
23
24
25
# File 'app/components/irelia/sidebar/navigation/link/component.rb', line 21

def initialize(**options)
  super

  @html_options[:method] = @method if @method != :get
end

Instance Method Details

#tag_helper(*args, &block) ⇒ Object



9
10
11
# File 'app/components/irelia/sidebar/navigation/link/component.rb', line 9

def tag_helper(*args, &block)
  method == :get ? link_to(*args, &block) : button_to(*args, &block)
end

#variantsObject



13
14
15
16
17
18
19
# File 'app/components/irelia/sidebar/navigation/link/component.rb', line 13

def variants
  class_names(
    "irelia-sidebar__navigation__link",
    "irelia-sidebar__navigation__link--default": variant == :default,
    "irelia-sidebar__navigation__link--active": active
  )
end