2022-08-06 18:34:03 +05:30
|
|
|
<script lang="ts">
|
2023-02-03 23:25:33 +05:30
|
|
|
import ThemeToggle from "$lib/Nav/ThemeToggle.svelte";
|
2022-08-06 18:34:03 +05:30
|
|
|
import { page } from "$app/stores";
|
2023-02-03 23:25:33 +05:30
|
|
|
import { slide } from "svelte/transition"
|
|
|
|
import { quintOut } from "svelte/easing";
|
2022-08-06 18:34:03 +05:30
|
|
|
|
|
|
|
$: currentPage = $page.url.pathname;
|
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
$: innerWidth = 0;
|
2022-12-27 20:58:47 +05:30
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
$: isMobile = innerWidth < 1090;
|
2022-12-27 20:58:47 +05:30
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
$: hasJS = typeof Window !== "undefined";
|
2022-12-27 20:58:47 +05:30
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
$: showMenuButton = hasJS && isMobile;
|
2022-12-27 20:58:47 +05:30
|
|
|
|
2023-02-03 23:25:33 +05:30
|
|
|
$: menuOpen = !hasJS || (hasJS && !isMobile);
|
2022-12-27 20:58:47 +05:30
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
$: menuOpenMobile = isMobile && menuOpen;
|
2023-01-05 22:42:43 +05:30
|
|
|
|
2023-01-25 22:41:11 +05:30
|
|
|
$: showThemeToggle = hasJS;
|
2022-12-27 20:58:47 +05:30
|
|
|
|
2023-02-03 23:25:33 +05:30
|
|
|
const toggleMenu = () => (menuOpen = !menuOpen);
|
2022-12-27 20:58:47 +05:30
|
|
|
|
2023-02-03 23:25:33 +05:30
|
|
|
const handleNavigation = () =>
|
|
|
|
showMenuButton ? (menuOpen = false) : (menuOpen = true);
|
2022-12-27 20:58:47 +05:30
|
|
|
|
2022-08-06 18:34:03 +05:30
|
|
|
const menus = [
|
2022-09-10 21:28:19 +05:30
|
|
|
{ name: "Instances", url: "/instances" },
|
2022-08-08 10:50:03 +05:30
|
|
|
{ name: "Donate", url: "/donate" },
|
2023-02-17 21:56:35 +05:30
|
|
|
{ name: "Pubnix", url: "/pubnix" },
|
2023-01-25 22:41:11 +05:30
|
|
|
{ name: "Contact", url: "/contact" },
|
|
|
|
{ name: "Team", url: "/team" },
|
|
|
|
{
|
|
|
|
name: "Wiki",
|
|
|
|
url: "https://wiki.projectsegfau.lt/",
|
|
|
|
external: true
|
|
|
|
},
|
2022-12-30 22:32:49 +05:30
|
|
|
{ name: "Blog", url: "/blog" },
|
2022-12-27 20:58:47 +05:30
|
|
|
{
|
|
|
|
name: "Status",
|
|
|
|
url: "https://status.projectsegfau.lt/",
|
|
|
|
external: true
|
2023-01-25 22:41:11 +05:30
|
|
|
},
|
|
|
|
{ name: "Legal", url: "/legal" }
|
2022-08-08 10:50:03 +05:30
|
|
|
];
|
2022-12-27 20:58:47 +05:30
|
|
|
</script>
|
2022-07-27 22:20:48 +05:30
|
|
|
|
2022-12-27 20:58:47 +05:30
|
|
|
<svelte:window bind:innerWidth />
|
2022-07-27 22:20:48 +05:30
|
|
|
|
2022-12-27 20:58:47 +05:30
|
|
|
<nav
|
2023-02-03 23:25:33 +05:30
|
|
|
class="bg-primary {menuOpenMobile
|
|
|
|
? 'border-none'
|
|
|
|
: 'border-b border-b-solid border-b-grey'} {isMobile
|
|
|
|
? 'py-2'
|
|
|
|
: ''} flex px-2 flex-col justify-between nav:(flex-row items-center) {hasJS
|
|
|
|
? 'sticky top-0 z-50'
|
|
|
|
: 'border-b border-b-solid border-b-grey'}"
|
2022-12-27 20:58:47 +05:30
|
|
|
>
|
|
|
|
<div class="flex flex-row items-center justify-between">
|
2022-10-01 18:41:54 +05:30
|
|
|
<a
|
2023-02-03 23:25:33 +05:30
|
|
|
class="flex items-center decoration-none text-text gap-2 transition-filter duration-250"
|
2022-12-27 20:58:47 +05:30
|
|
|
href="/"
|
2022-10-01 18:41:54 +05:30
|
|
|
>
|
2022-12-27 20:58:47 +05:30
|
|
|
<img
|
|
|
|
src="/logo.png"
|
|
|
|
alt="Project Segfault logo"
|
|
|
|
class="h-7"
|
|
|
|
/>
|
|
|
|
<span>Project Segfault</span>
|
2022-08-04 21:20:02 +05:30
|
|
|
</a>
|
2022-12-27 20:58:47 +05:30
|
|
|
|
|
|
|
{#if showMenuButton}
|
|
|
|
<button
|
|
|
|
on:click={toggleMenu}
|
2023-02-03 23:25:33 +05:30
|
|
|
class="{menuOpen
|
|
|
|
? 'i-ic:outline-close'
|
|
|
|
: 'i-ic:outline-menu'} h-4 w-4 cursor-pointer mr-2"
|
2022-12-27 20:58:47 +05:30
|
|
|
/>
|
|
|
|
{/if}
|
2022-07-27 22:20:48 +05:30
|
|
|
</div>
|
2022-06-18 00:22:07 +05:30
|
|
|
|
2022-12-27 20:58:47 +05:30
|
|
|
{#if menuOpen}
|
|
|
|
<div
|
2023-02-03 23:25:33 +05:30
|
|
|
class="links flex flex-row gap-2 {isMobile
|
|
|
|
? '!children:py-2'
|
|
|
|
: ''} {hasJS
|
|
|
|
? 'lt-nav:(flex flex-col pt-2 gap-2 fixed bg-primary w-full left-0 top-[2.75rem] p-2 z-50 border-b-solid border-b border-b-grey shadow shadow-secondary)'
|
|
|
|
: 'lt-nav:(grid grid-cols-2 gap-2 pt-2 w-fit)'}"
|
|
|
|
transition:slide={{ duration: 300, easing: quintOut }}
|
2022-12-27 20:58:47 +05:30
|
|
|
>
|
|
|
|
{#each menus as { url, name, external }}
|
|
|
|
<a
|
|
|
|
class:active={url !== "/"
|
|
|
|
? currentPage.match(url)
|
|
|
|
: url === currentPage}
|
|
|
|
href={url}
|
|
|
|
on:click={handleNavigation}
|
|
|
|
>{#if external}
|
2023-02-03 23:25:33 +05:30
|
|
|
<div class="i-ic:outline-open-in-new mr-2 h-4 w-4" />
|
2022-12-27 20:58:47 +05:30
|
|
|
{/if}
|
|
|
|
{name}
|
|
|
|
</a>
|
|
|
|
{/each}
|
|
|
|
<a
|
|
|
|
href="https://matrix.to/#/#project-segfault:projectsegfau.lt/"
|
|
|
|
class="icon"
|
|
|
|
>
|
|
|
|
<div class="i-simple-icons:matrix" />
|
|
|
|
<span>Matrix</span>
|
|
|
|
</a>
|
|
|
|
<a
|
|
|
|
href="https://github.com/ProjectSegfault/"
|
|
|
|
class="icon"
|
|
|
|
>
|
|
|
|
<div class="i-simple-icons:github" />
|
|
|
|
<span>GitHub</span>
|
|
|
|
</a>
|
|
|
|
{#if showThemeToggle}
|
|
|
|
<div class="icon">
|
|
|
|
<ThemeToggle />
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</nav>
|
2022-08-24 21:37:30 +05:30
|
|
|
|
2022-06-18 00:22:07 +05:30
|
|
|
<style>
|
2022-08-06 18:34:03 +05:30
|
|
|
a.active {
|
2022-12-27 20:58:47 +05:30
|
|
|
@apply text-accent;
|
2022-07-27 22:15:53 +05:30
|
|
|
}
|
2022-06-18 00:22:07 +05:30
|
|
|
|
2022-06-18 21:56:58 +05:30
|
|
|
.links > * {
|
2023-02-03 23:25:33 +05:30
|
|
|
@apply py-4 px-2 text-text decoration-none transition-filter duration-250 text-sm flex items-center;
|
2022-06-18 21:56:58 +05:30
|
|
|
}
|
2022-06-18 14:47:19 +05:30
|
|
|
|
2022-12-27 20:58:47 +05:30
|
|
|
.icon > span {
|
2023-02-03 23:25:33 +05:30
|
|
|
@apply text-sm nav\:hidden;
|
2022-07-27 22:15:53 +05:30
|
|
|
}
|
|
|
|
|
2022-12-27 20:58:47 +05:30
|
|
|
.icon {
|
2023-02-03 23:25:33 +05:30
|
|
|
@apply flex items-center gap-2 text-base;
|
2022-06-18 21:56:58 +05:30
|
|
|
}
|
2022-07-27 22:20:48 +05:30
|
|
|
</style>
|