1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Sidebar nav tweak

This commit is contained in:
Josh Pigford 2024-02-11 12:56:23 -06:00
parent a824e9d777
commit b2fdf78101
2 changed files with 11 additions and 10 deletions

View file

@ -19,17 +19,18 @@ module ApplicationHelper
end
def sidebar_link_to(name, path, options = {})
base_class_names = "block border border-transparent rounded-xl -ml-2 p-2 text-sm font-medium text-gray-500 flex items-center"
hover_class_names = "hover:bg-white hover:border-[#141414]/[0.07] hover:text-gray-900 hover:shadow-xs"
current_page_class_names = "bg-white border-[#141414]/[0.07] text-gray-900 shadow-xs"
base_class_names = [ "block", "border", "border-transparent", "rounded-xl", "-ml-2", "p-2", "text-sm", "font-medium", "text-gray-500", "flex", "items-center" ]
hover_class_names = [ "hover:bg-white", "hover:border-[#141414]/[0.07]", "hover:text-gray-900", "hover:shadow-xs" ]
current_page_class_names = [ "bg-white", "border-[#141414]/[0.07]", "text-gray-900", "shadow-xs" ]
link_class_names = class_names(
base_class_names,
hover_class_names,
current_page_class_names => current_page?(path)
)
link_class_names = if current_page?(path)
base_class_names.delete("border-transparent")
base_class_names + hover_class_names + current_page_class_names
else
base_class_names + hover_class_names
end
merged_options = options.reverse_merge(class: link_class_names).except(:icon)
merged_options = options.reverse_merge(class: link_class_names.join(" ")).except(:icon)
link_to path, merged_options do
lucide_icon(options[:icon], class: "w-5 h-5 mr-2") + name

View file

@ -45,7 +45,7 @@
</div>
</div>
<nav>
<ul class="mt-6 space-y">
<ul class="mt-6 space-y-1">
<li>
<%= sidebar_link_to t('.dashboard'), root_path, icon: 'layout-grid' %>
</li>