svgl/src/routes/+layout.svelte

99 lines
3.3 KiB
Svelte
Raw Normal View History

<script lang="ts">
2023-03-19 14:53:18 +00:00
import type { LayoutServerData } from './$types';
export let data: LayoutServerData;
2023-03-15 11:24:26 +00:00
// Global styles:
import '../app.css';
// Get categories:
2023-03-19 14:53:18 +00:00
import { svgs } from '@/data/svgs';
const categories = svgs
2023-03-15 11:24:26 +00:00
.map((svg) => svg.category)
.filter((category, index, array) => array.indexOf(category) === index);
// Icons:
2023-03-15 13:54:56 +00:00
import Heart from 'phosphor-svelte/lib/Heart';
2023-12-12 00:59:12 +00:00
import { ArrowUpRight } from 'lucide-svelte';
2023-03-15 11:24:26 +00:00
// Toaster:
2023-07-07 09:34:08 +01:00
import { Toaster } from 'svelte-sonner';
2023-03-20 10:30:32 +00:00
// Components for all pages:
2023-03-19 14:53:18 +00:00
import Transition from '@/components/transition.svelte';
2023-12-11 23:31:12 +00:00
// Layout:
import Navbar from '@/components/navbar.svelte';
2023-12-12 00:59:12 +00:00
import { cn } from '@/utils/cn';
2023-03-15 11:24:26 +00:00
</script>
2023-12-11 23:31:12 +00:00
<Navbar />
<main>
2023-12-11 23:31:12 +00:00
<aside
2023-12-12 00:59:12 +00:00
class={cn(
'z-50 w-full overflow-y-auto overflow-x-hidden',
'dark:border-neutral-800 md:fixed md:left-0 md:h-full md:w-56 md:pb-10',
'bg-neutral-100 dark:bg-neutral-900',
'backdrop-blur-md opacity-95',
'border-r border-neutral-200 dark:border-neutral-800'
)}
2023-03-19 16:44:15 +00:00
>
2023-03-20 10:30:32 +00:00
<div class="px-6 py-6">
2023-03-19 16:44:15 +00:00
<div
2023-03-20 10:30:32 +00:00
class="flex items-center space-x-1 overflow-y-auto border-b border-neutral-300 pb-3 dark:border-neutral-700/40 md:mb-3 md:flex-col md:space-x-0 md:space-y-1 md:overflow-y-visible"
2023-03-19 16:44:15 +00:00
>
2023-03-22 09:21:15 +00:00
<a
href="/"
2023-11-14 10:42:03 +00:00
class={`flex w-full items-center rounded-md p-2 transition-none duration-100 hover:bg-neutral-200 dark:hover:bg-neutral-700/40 text-neutral-600 hover:text-dark dark:hover:text-white dark:text-neutral-400 ${
data.pathname === `/`
? 'bg-neutral-200 dark:bg-neutral-700/30 font-medium dark:text-white text-dark'
: ''
}`}
2023-03-22 09:21:15 +00:00
data-sveltekit-preload-data>All</a
>
2023-07-07 10:08:56 +01:00
<!-- Order alfabetically: -->
{#each categories.sort() as category}
2023-03-15 11:24:26 +00:00
<a
href={`/directory/${category.toLowerCase()}`}
2023-12-16 17:44:30 +00:00
class={cn(
'flex w-full items-center justify-between rounded-md p-2 transition-none duration-100 text-neutral-600 hover:text-dark dark:hover:text-white dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-700/40',
data.pathname === `/directory/${category.toLowerCase()}`
? 'bg-neutral-200 dark:bg-neutral-700/30 font-medium dark:text-white text-dark'
: ''
)}
2023-03-15 11:24:26 +00:00
>
2023-12-16 17:44:30 +00:00
<span>{category}</span>
</a>
2023-03-15 11:24:26 +00:00
{/each}
</div>
2023-12-16 17:44:30 +00:00
<div></div>
2023-03-15 13:54:56 +00:00
<a
href="https://twitter.com/pheralb_"
target="_blank"
2023-12-16 17:44:30 +00:00
class="group mt-5 md:flex hidden items-center space-x-2 duration-100 hover:text-dark dark:text-neutral-400 dark:hover:text-white"
2023-03-15 13:54:56 +00:00
>
2023-03-19 21:36:46 +00:00
<Heart color="#991b1b" size={18} weight={'duotone'} />
2023-03-15 13:54:56 +00:00
<div class="flex items-center space-x-1">
<p class="text-muted text-sm">Created by pheralb</p>
2023-12-16 17:44:30 +00:00
<ArrowUpRight
size={14}
class="transition-transform duration-300 group-hover:-translate-y-[1px]"
/>
2023-03-15 13:54:56 +00:00
</div>
</a>
2023-03-15 11:24:26 +00:00
</div>
2023-12-11 23:31:12 +00:00
</aside>
<div class="md:ml-56 pb-6">
2023-03-19 14:53:18 +00:00
<Transition pathname={data.pathname}>
<slot />
</Transition>
2023-07-07 09:34:08 +01:00
<Toaster
position="bottom-right"
toastOptions={{
2023-10-29 13:58:11 +00:00
style: `background-color: #171717;
color: #ffff;
border-radius: 0.4rem; border: 1px solid #262626;`
2023-07-07 09:34:08 +01:00
}}
/>
2023-03-15 11:24:26 +00:00
</div>
</main>