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