mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 06:14:22 +01:00
144 lines
7.5 KiB
Plaintext
144 lines
7.5 KiB
Plaintext
package main
|
|
|
|
templ topTemplate(params HeadParams) {
|
|
<header class="print:block flex flex-row text-base sm:p-4 sm:pb-6">
|
|
<div class="hidden sm:block sm:w-[14%]"></div>
|
|
<!-- Mobile header -->
|
|
<div class="fixed top-0 left-0 right-0 flex justify-between items-center w-full sm:hidden z-40 p-4 bg-white dark:bg-neutral-900">
|
|
<!-- Join Nostr Button (Mobile - Left) -->
|
|
<a href="https://nstart.me" class="px-2 py-1 bg-strongpink text-neutral-50 rounded-md text-nowrap">Join Nostr</a>
|
|
<!-- Hamburger menu utton -->
|
|
<button
|
|
id="mobile-menu-button"
|
|
class="w-8 h-8 flex flex-col justify-center items-center"
|
|
_="on click toggle .hidden on #mobile-menu-overlay"
|
|
>
|
|
<span class="block w-6 h-0.5 bg-gray-800 dark:bg-gray-200 mb-1.5"></span>
|
|
<span class="block w-6 h-0.5 bg-gray-800 dark:bg-gray-200 mb-1.5"></span>
|
|
<span class="block w-6 h-0.5 bg-gray-800 dark:bg-gray-200"></span>
|
|
</button>
|
|
</div>
|
|
<!-- Mobile header spacer - Prevents content from hiding under fixed header -->
|
|
<div class="h-16 w-full sm:hidden"></div>
|
|
<!-- Desktop header -->
|
|
<div class="hidden sm:block sm:w-[72%] sm:text-right">
|
|
<div class="hidden">
|
|
<a href="/npubs-archive/">Nostr npubs archive</a>
|
|
<a href="/relays-archive/">Nostr relays archive</a>
|
|
</div>
|
|
if !(params.IsHome) {
|
|
<a href="/" class="mr-4">Why <span class="text-strongpink">Nostr</span>?</a>
|
|
}
|
|
if params.IsHome {
|
|
<a href="#getstarted" class="mr-4 hover:text-strongpink">Get started</a>
|
|
<a href="#resources" class="mr-4 hover:text-strongpink">Apps & Resources</a>
|
|
<a href="#development" class="mr-4 hover:text-strongpink">Join the development</a>
|
|
}
|
|
if !(params.IsAbout) {
|
|
<a href="/about" class="mr-4">What is <span class="text-strongpink">Njump</span>?</a>
|
|
}
|
|
<a href="https://nstart.me" class="leading-9 mr-4 px-2 py-1 bg-strongpink text-neutral-50 rounded-md text-nowrap">Join Nostr</a>
|
|
</div>
|
|
<div class="hidden sm:block sm:w-[14%]">
|
|
<div
|
|
class="print:hidden; relative float-right h-4 w-4 cursor-pointer rounded-full text-gray-100 dark:text-gray-700 sm:fixed sm:right-4 sm:top-4 sm:float-none"
|
|
_="on click tell <html /> toggle between .theme--dark and .theme--default then get your @class then get it[0].split('--')[1].split(' ')[0] then set localStorage.theme to it
|
|
on load tell <html /> get localStorage.theme then if it is 'dark' add .theme--dark then remove .theme--default else if it is not 'default' then get window.matchMedia('(prefers-color-scheme: dark)').matches then if it is true add .theme--dark then remove .theme--default end"
|
|
>
|
|
<svg
|
|
aria-hidden="true"
|
|
data-prefix="fas"
|
|
class="block dark:hidden"
|
|
role="img"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 512 512"
|
|
>
|
|
<path
|
|
fill="currentColor"
|
|
d="M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"
|
|
></path>
|
|
</svg>
|
|
<svg
|
|
aria-hidden="true"
|
|
data-prefix="fas"
|
|
class="hidden dark:block"
|
|
role="img"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 512 512"
|
|
>
|
|
<path
|
|
fill="currentColor"
|
|
d="M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"
|
|
></path>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<!-- Mobile menu overlay -->
|
|
<div id="mobile-menu-overlay" class="hidden fixed inset-0 bg-neutral-50 dark:bg-neutral-800 z-50 flex flex-col items-center justify-center">
|
|
<!-- Close Button -->
|
|
<button
|
|
class="absolute top-4 right-4 text-neutral-800 dark:text-neutral-50 w-8 h-8"
|
|
_="on click toggle .hidden on #mobile-menu-overlay"
|
|
>
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M6 18L18 6M6 6l12 12"></path>
|
|
</svg>
|
|
</button>
|
|
<!-- Menu items -->
|
|
<div class="flex flex-col items-center space-y-8 text-xl text-neutral-800 dark:text-neutral-50 font-semibold">
|
|
if params.IsHome {
|
|
<a href="#" class="text-2xl hover:text-strongpink" _="on click toggle .hidden on #mobile-menu-overlay">Why Nostr?</a>
|
|
<a href="#getstarted" class="text-2xl hover:text-strongpink" _="on click toggle .hidden on #mobile-menu-overlay">Get started</a>
|
|
<a href="#resources" class="text-2xl hover:text-strongpink" _="on click toggle .hidden on #mobile-menu-overlay">Apps & Resources</a>
|
|
<a href="#development" class="text-2xl hover:text-strongpink" _="on click toggle .hidden on #mobile-menu-overlay">Join the development</a>
|
|
}
|
|
if (!(params.IsAbout) && !(params.IsHome)) || params.IsAbout {
|
|
<a href="/" class="text-2xl hover:text-strongpink">Why Nostr?</a>
|
|
}
|
|
if !(params.IsAbout) {
|
|
<a href="/about" class="text-2xl hover:text-strongpink">What is Njump?</a>
|
|
}
|
|
<a href="https://nstart.me" class="text-2xl text-strongpink">Join Nostr</a>
|
|
</div>
|
|
<!-- Theme toggle -->
|
|
<div class="absolute bottom-16 flex justify-center items-center space-x-3 text-neutral-400 dark:text-neutral-500 font-semibold">
|
|
<div
|
|
class="p-2 cursor-pointer rounded-full flex gap-4"
|
|
_="on click tell <html /> toggle between .theme--dark and .theme--default then get your @class then get it[0].split('--')[1].split(' ')[0] then set localStorage.theme to it then toggle .hidden on #mobile-menu-overlay"
|
|
>
|
|
<svg
|
|
aria-hidden="true"
|
|
data-prefix="fas"
|
|
class="block dark:hidden h-6 w-6"
|
|
role="img"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 512 512"
|
|
>
|
|
<path
|
|
fill="currentColor"
|
|
d="M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"
|
|
></path>
|
|
</svg>
|
|
<svg
|
|
aria-hidden="true"
|
|
data-prefix="fas"
|
|
class="hidden dark:block h-6 w-6"
|
|
role="img"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 512 512"
|
|
>
|
|
<path
|
|
fill="currentColor"
|
|
d="M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"
|
|
></path>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/hyperscript">
|
|
on beforeprint from window tell <html /> remove .theme--dark add .theme--default
|
|
on afterprint from window tell <html /> add .theme--dark remove .theme--default
|
|
</script>
|
|
}
|