1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 21:29:38 +02:00

Improve active class assignment in sidebar links (#450)

* Fix active class assignment in sidebar links

* Revert "Fix active class assignment in sidebar links"

This reverts commit 55924f32db.

* Update sidebar_link_to helper to correctly assign active class for nested routes

---------

Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
This commit is contained in:
Mattia 2024-02-14 12:55:23 +00:00 committed by GitHub
parent 101a5ee0c5
commit 0490fda465
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,7 +34,7 @@ module ApplicationHelper
hover_class_names = [ "hover:bg-white", "hover:border-alpha-black-50", "hover:text-gray-900", "hover:shadow-xs" ] hover_class_names = [ "hover:bg-white", "hover:border-alpha-black-50", "hover:text-gray-900", "hover:shadow-xs" ]
current_page_class_names = [ "bg-white", "border-alpha-black-50", "text-gray-900", "shadow-xs" ] current_page_class_names = [ "bg-white", "border-alpha-black-50", "text-gray-900", "shadow-xs" ]
link_class_names = if current_page?(path) link_class_names = if current_page?(path) || (request.path.start_with?(path) && path != "/")
base_class_names.delete("border-transparent") base_class_names.delete("border-transparent")
base_class_names + hover_class_names + current_page_class_names base_class_names + hover_class_names + current_page_class_names
else else