feat: add nav_link method to ApplicationHelper #431

Closed
ezhil56x wants to merge 4 commits from menu-helper into main
ezhil56x commented 2024-02-11 12:19:28 +08:00 (Migrated from github.com)

Changes

  • Added the nav_link method to ApplicationHelper.
  • Updated the nav_link method to include hover and selected states.

/claim #428

### Changes - Added the nav_link method to ApplicationHelper. - Updated the nav_link method to include hover and selected states. /claim #428
ezhil56x commented 2024-02-11 13:09:50 +08:00 (Migrated from github.com)

@Shpigford Can you review this PR once?

@Shpigford Can you review this PR once?
robzolkos (Migrated from github.com) reviewed 2024-02-11 14:26:08 +08:00
@@ -50,4 +50,16 @@ module ApplicationHelper
robzolkos (Migrated from github.com) commented 2024-02-11 14:26:08 +08:00

A more specific name for this particular nav link may be better in-case there are other nav related links? Perhaps main_nav_link ?

A more specific name for this particular nav link may be better in-case there are other nav related links? Perhaps `main_nav_link` ?
robzolkos (Migrated from github.com) reviewed 2024-02-11 14:39:31 +08:00
@@ -50,4 +50,16 @@ module ApplicationHelper
robzolkos (Migrated from github.com) commented 2024-02-11 14:39:31 +08:00
    classes = 'block border border-transparent rounded-xl p-2 text-sm font-medium text-gray-500 flex items-center'
    hover_classes = 'hover:bg-white hover:border-[#141414]/[0.07] hover:text-gray-900 hover:shadow-xs'
    apply_hover_classes = true unless current_page
  
    content_tag(:li) do
      link_to(path, class: class_list(classes, hover_classes: apply_hover_classes) do
```suggestion classes = 'block border border-transparent rounded-xl p-2 text-sm font-medium text-gray-500 flex items-center' hover_classes = 'hover:bg-white hover:border-[#141414]/[0.07] hover:text-gray-900 hover:shadow-xs' apply_hover_classes = true unless current_page content_tag(:li) do link_to(path, class: class_list(classes, hover_classes: apply_hover_classes) do ```
robzolkos (Migrated from github.com) reviewed 2024-02-11 14:43:02 +08:00
@@ -50,4 +50,16 @@ module ApplicationHelper
robzolkos (Migrated from github.com) commented 2024-02-11 14:43:02 +08:00

note: current_page is already passed in as a boolean so I don't think you need the current_path?(path) test again?

note: `current_page` is already passed in as a boolean so I don't think you need the `current_path?(path)` test again?
ezhil56x (Migrated from github.com) reviewed 2024-02-11 15:00:08 +08:00
@@ -50,4 +50,16 @@ module ApplicationHelper
ezhil56x (Migrated from github.com) commented 2024-02-11 15:00:08 +08:00

Done👍🏻

Done👍🏻
ezhil56x (Migrated from github.com) reviewed 2024-02-11 15:00:14 +08:00
@@ -50,4 +50,16 @@ module ApplicationHelper
ezhil56x (Migrated from github.com) commented 2024-02-11 15:00:14 +08:00

Done👍🏻

Done👍🏻
Shpigford commented 2024-02-12 02:49:30 +08:00 (Migrated from github.com)

Closing in favor of #435. Thank you for working on this!

Closing in favor of #435. Thank you for working on this!

Pull request closed

Sign in to join this conversation.