this repo has no description
1{{ define "layouts/fragments/topbar" }}
2 <nav class="space-x-4 px-6 py-2 rounded-b bg-white dark:bg-gray-800 dark:text-white drop-shadow-sm">
3 <div class="flex justify-between p-0 items-center">
4 <div id="left-items">
5 <a href="/" hx-boost="true" class="text-2xl no-underline hover:no-underline">
6 {{ template "fragments/logotypeSmall" }}
7 </a>
8 </div>
9
10 <div id="right-items" class="flex items-center gap-4">
11 {{ with .LoggedInUser }}
12 {{ block "newButton" . }} {{ end }}
13 {{ template "notifications/fragments/bell" }}
14 {{ block "dropDown" . }} {{ end }}
15 {{ else }}
16 <a href="/login">login</a>
17 <span class="text-gray-500 dark:text-gray-400">or</span>
18 <a href="/signup" class="btn-create py-0 hover:no-underline hover:text-white flex items-center gap-2">
19 join now {{ i "arrow-right" "size-4" }}
20 </a>
21 {{ end }}
22 </div>
23 </div>
24 </nav>
25{{ end }}
26
27{{ define "newButton" }}
28<details class="relative inline-block text-left nav-dropdown">
29 <summary class="btn-create py-0 cursor-pointer list-none flex items-center gap-2">
30 {{ i "plus" "w-4 h-4" }} new
31 </summary>
32 <div class="absolute flex flex-col right-0 mt-4 p-4 rounded w-48 bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700">
33 <a href="/repo/new" class="flex items-center gap-2">
34 {{ i "book-plus" "w-4 h-4" }}
35 new repository
36 </a>
37 <a href="/strings/new" class="flex items-center gap-2">
38 {{ i "line-squiggle" "w-4 h-4" }}
39 new string
40 </a>
41 </div>
42</details>
43{{ end }}
44
45{{ define "dropDown" }}
46<details class="relative inline-block text-left nav-dropdown">
47 <summary
48 class="cursor-pointer list-none flex items-center gap-1"
49 >
50 {{ $user := didOrHandle .Did .Handle }}
51 {{ template "user/fragments/picHandle" $user }}
52 </summary>
53 <div
54 class="absolute flex flex-col right-0 mt-4 p-4 rounded w-48 bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700"
55 >
56 <a href="/{{ $user }}">profile</a>
57 <a href="/{{ $user }}?tab=repos">repositories</a>
58 <a href="/{{ $user }}?tab=strings">strings</a>
59 <a href="/knots">knots</a>
60 <a href="/spindles">spindles</a>
61 <a href="/settings">settings</a>
62 <a href="#"
63 hx-post="/logout"
64 hx-swap="none"
65 class="text-red-400 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300">
66 logout
67 </a>
68 </div>
69</details>
70
71<script>
72document.addEventListener('click', function(event) {
73 const dropdowns = document.querySelectorAll('.nav-dropdown');
74 dropdowns.forEach(function(dropdown) {
75 if (!dropdown.contains(event.target)) {
76 dropdown.removeAttribute('open');
77 }
78 });
79});
80</script>
81{{ end }}