Skip to content

Commit 7a386ad

Browse files
zalepaclaude
andcommitted
Replace sidebar with bottom navbar on mobile for dashboard layout
On mobile (<md), the sidebar is now hidden and a fixed bottom navigation bar provides access to key sections. The main content area gets full width. Desktop sidebar behavior is unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9dc9585 commit 7a386ad

2 files changed

Lines changed: 31 additions & 6 deletions

File tree

app/helpers/application_helper.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ def sidebar_icon(name, active = false)
5757
end
5858
end
5959

60+
def bottom_nav_link(label, path, icon_name)
61+
active = current_sidebar_item == icon_name
62+
base_classes = "flex flex-col items-center justify-center gap-0.5 flex-1 py-1 text-[10px] font-medium transition-colors"
63+
active_classes = active ? "text-blue-700" : "text-gray-500"
64+
65+
link_to path, class: "#{base_classes} #{active_classes}" do
66+
concat(sidebar_icon(icon_name, active))
67+
concat(content_tag(:span, label))
68+
end
69+
end
70+
6071
def star_button(starrable, starred: nil)
6172
return unless authenticated?
6273

app/views/layouts/dashboard.html.erb

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@
3737
<% if Current.session&.user&.admin? %>
3838
<%= link_to "Admin", admin_dashboard_path, class: "hover:text-blue-700 transition-colors" %>
3939
<% end %>
40-
<%= link_to "Profile", edit_profile_path, class: "hover:text-blue-700 transition-colors" %>
41-
<%= button_to "Sign out", session_path, method: :delete, class: "hover:text-blue-700 transition-colors cursor-pointer" %>
40+
<%= link_to "Profile", edit_profile_path, class: "hover:text-blue-700 transition-colors hidden sm:inline" %>
41+
<%= button_to "Sign out", session_path, method: :delete, class: "hover:text-blue-700 transition-colors cursor-pointer hidden sm:inline" %>
4242
<% else %>
4343
<%= link_to "Sign in", new_session_path, class: "hover:text-blue-700 transition-colors" %>
44-
<%= link_to "Sign up", new_signup_path, class: "hover:text-blue-700 transition-colors" %>
44+
<%= link_to "Sign up", new_signup_path, class: "hover:text-blue-700 transition-colors hidden sm:inline" %>
4545
<% end %>
4646
</div>
4747
</div>
4848
</header>
4949

5050
<div class="flex flex-1 overflow-hidden" data-controller="sidebar">
51-
<%# Sidebar %>
52-
<aside data-sidebar-target="sidebar" class="w-16 bg-white border-r border-gray-200 flex flex-col transition-all duration-200 ease-in-out shrink-0">
51+
<%# Desktop sidebar - hidden on mobile %>
52+
<aside data-sidebar-target="sidebar" class="hidden md:flex w-16 bg-white border-r border-gray-200 flex-col transition-all duration-200 ease-in-out shrink-0">
5353
<div class="p-3">
5454
<button data-action="click->sidebar#toggle" class="w-10 h-10 flex items-center justify-center rounded-lg text-gray-500 hover:bg-gray-100 hover:text-gray-700 transition-colors cursor-pointer" aria-label="Toggle sidebar">
5555
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
@@ -72,7 +72,7 @@
7272
</aside>
7373

7474
<%# Main content %>
75-
<main class="flex-1 overflow-y-auto">
75+
<main class="flex-1 overflow-y-auto pb-16 md:pb-0">
7676
<% if notice %>
7777
<div class="px-6 pt-4">
7878
<p class="py-2 px-3 bg-green-50 text-green-700 font-medium rounded-lg" id="notice"><%= notice %></p>
@@ -86,5 +86,19 @@
8686
<%= yield %>
8787
</main>
8888
</div>
89+
90+
<%# Mobile bottom navigation - hidden on desktop %>
91+
<nav class="md:hidden fixed bottom-0 inset-x-0 bg-white border-t border-gray-200 z-50">
92+
<div class="flex items-center justify-around h-16 px-2">
93+
<%= bottom_nav_link("Dashboard", dashboard_path, "dashboard") %>
94+
<%= bottom_nav_link("Meetings", meetings_path, "meetings") %>
95+
<%= bottom_nav_link("Council", council_members_path, "council_members") %>
96+
<%= bottom_nav_link("Topics", tags_path, "topics") %>
97+
<%= bottom_nav_link("Search", search_path, "search") %>
98+
<% if authenticated? %>
99+
<%= bottom_nav_link("Starred", stars_path, "starred") %>
100+
<% end %>
101+
</div>
102+
</nav>
89103
</body>
90104
</html>

0 commit comments

Comments
 (0)