Skip to content

Commit 117c987

Browse files
authored
fix(webui): display small navbar with smaller screens (#2240)
Signed-off-by: mudler <[email protected]>
1 parent 17e94fb commit 117c987

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

core/http/views/partials/navbar.html

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
<a href="/" class="text-white text-xl font-bold"><img src="https://github.com/go-skynet/LocalAI/assets/2420543/0966aa2a-166e-4f99-a3e5-6c915fc997dd" alt="LocalAI Logo" class="h-10 mr-3 border-2 border-gray-300 shadow rounded"></a>
77
<a href="/" class="text-white text-xl font-bold">LocalAI</a>
88
</div>
9-
<div>
9+
<!-- Menu button for small screens -->
10+
<div class="lg:hidden">
11+
<button id="menu-toggle" class="text-gray-400 hover:text-white focus:outline-none">
12+
<i class="fas fa-bars fa-lg"></i>
13+
</button>
14+
</div>
15+
<!-- Navigation links -->
16+
<div class="hidden lg:flex lg:items-center lg:justify-end lg:flex-1 lg:w-0">
1017
<a href="/" class="text-gray-400 hover:text-white px-3 py-2 rounded"><i class="fas fa-home pr-2"></i>Home</a>
1118
<a href="https://localai.io" class="text-gray-400 hover:text-white px-3 py-2 rounded" target="_blank" ><i class="fas fa-book-reader pr-2"></i> Documentation</a>
1219
<a href="/browse/" class="text-gray-400 hover:text-white px-3 py-2 rounded"><i class="fas fa-brain pr-2"></i> Models</a>
@@ -16,5 +23,25 @@
1623
<a href="/swagger/" class="text-gray-400 hover:text-white px-3 py-2 rounded"><i class="fas fa-code pr-2"></i> API</a>
1724
</div>
1825
</div>
26+
<!-- Collapsible menu for small screens -->
27+
<div class="hidden lg:hidden" id="mobile-menu">
28+
<div class="pt-4 pb-3 border-t border-gray-700">
29+
<a href="/" class="block text-gray-400 hover:text-white px-3 py-2 rounded mt-1"><i class="fas fa-home pr-2"></i>Home</a>
30+
<a href="https://localai.io" class="block text-gray-400 hover:text-white px-3 py-2 rounded mt-1" target="_blank" ><i class="fas fa-book-reader pr-2"></i> Documentation</a>
31+
<a href="/browse/" class="block text-gray-400 hover:text-white px-3 py-2 rounded mt-1"><i class="fas fa-brain pr-2"></i> Models</a>
32+
<a href="/chat/" class="block text-gray-400 hover:text-white px-3 py-2 rounded mt-1"><i class="fa-solid fa-comments pr-2"></i> Chat</a>
33+
<a href="/text2image/" class="block text-gray-400 hover:text-white px-3 py-2 rounded mt-1"><i class="fas fa-image pr-2"></i> Generate images</a>
34+
<a href="/tts/" class="block text-gray-400 hover:text-white px-3 py-2 rounded mt-1"><i class="fa-solid fa-music pr-2"></i> TTS </a>
35+
<a href="/swagger/" class="block text-gray-400 hover:text-white px-3 py-2 rounded mt-1"><i class="fas fa-code pr-2"></i> API</a>
36+
</div>
37+
</div>
1938
</div>
20-
</nav>
39+
</nav>
40+
41+
<script>
42+
// JavaScript to toggle the mobile menu
43+
document.getElementById('menu-toggle').addEventListener('click', function () {
44+
var mobileMenu = document.getElementById('mobile-menu');
45+
mobileMenu.classList.toggle('hidden');
46+
});
47+
</script>

0 commit comments

Comments
 (0)