Class: PhlexKit::NavigationMenuLink

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/navigation_menu/navigation_menu_link.rb

Overview

Plain link item (top-level or inside a panel). Hover fires #switch like a trigger: for a TOP-LEVEL link the closest menu item has no panel, so an open sibling panel closes; for a link INSIDE a panel the closest item IS the open menu, so switch is a no-op and the panel stays. See navigation_menu.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(href: "#", **attrs) ⇒ NavigationMenuLink

Returns a new instance of NavigationMenuLink.



8
9
10
11
# File 'app/components/phlex_kit/navigation_menu/navigation_menu_link.rb', line 8

def initialize(href: "#", **attrs)
  @href = href
  @attrs = attrs
end

Instance Method Details

#view_templateObject



13
14
15
# File 'app/components/phlex_kit/navigation_menu/navigation_menu_link.rb', line 13

def view_template(&)
  a(**mix({ class: "pk-navigation-menu-link", href: @href, data: { action: "mouseenter->phlex-kit--menubar#switch" } }, @attrs), &)
end