svgl/src/routes/+layout.svelte

139 lines
5.2 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-03-15 11:24:26 +00:00
import ArrowUpRight from 'phosphor-svelte/lib/ArrowUpRight';
2023-03-19 20:22:58 +00:00
import ArrowLeft from 'phosphor-svelte/lib/ArrowLeft';
2023-05-10 17:06:42 -03:00
import Star from 'phosphor-svelte/lib/Star';
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-03-19 20:22:58 +00:00
import Container from '@/components/container.svelte';
2023-03-20 10:30:32 +00:00
import Theme from '@/components/theme.svelte';
2023-03-15 11:24:26 +00:00
</script>
2023-03-20 10:30:32 +00:00
<main class="min-h-screen bg-light font-sans text-mini dark:bg-dark dark:text-white">
2023-03-19 16:44:15 +00:00
<nav
2023-05-10 17:06:42 -03:00
class="z-50 w-full overflow-y-auto overflow-x-hidden border-b border-neutral-300 dark:border-neutral-800 md:fixed md:left-0 md:top-0 md:h-full md:w-60 md:border-none md:pb-10"
2023-03-19 16:44:15 +00:00
>
2023-03-20 10:30:32 +00:00
<div class="px-6 py-6">
<div class="mb-3 border-b border-neutral-300 pb-3 dark:border-neutral-700/40">
<div class="flex items-center justify-between">
<a href="/">
2023-03-20 10:34:45 +00:00
<div
class="flex items-center space-x-2 duration-150 hover:text-neutral-500 dark:hover:text-neutral-300"
>
2023-03-20 10:30:32 +00:00
<h3 class="text-xl font-medium">svgl</h3>
2023-09-12 09:50:26 +01:00
<p class="text-neutral-500">v3.2.0</p>
2023-03-20 10:30:32 +00:00
</div>
</a>
<Theme />
</div>
2023-03-19 22:02:18 +00:00
<p class="mt-2 font-medium text-neutral-400">✨ Optimized SVGs for web</p>
2023-03-15 11:24:26 +00:00
</div>
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="/"
class={`flex w-full items-center rounded-md p-2 transition-none duration-100 hover:bg-neutral-200 dark:hover:bg-neutral-700/40
${data.pathname === `/` ? 'bg-neutral-200 dark:bg-neutral-700/30' : ''}`}
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-03-20 10:30:32 +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
2023-03-19 16:44:15 +00:00
${
2023-03-20 10:30:32 +00:00
data.pathname === `/directory/${category.toLowerCase()}`
? 'bg-neutral-200 dark:bg-neutral-700/30'
: ''
2023-03-19 16:44:15 +00:00
}`}
2023-03-19 14:53:18 +00:00
data-sveltekit-preload-data>{category}</a
2023-03-15 11:24:26 +00:00
>
{/each}
</div>
2023-03-19 16:44:15 +00:00
<div
2023-03-20 10:30:32 +00:00
class="mt-3 flex flex-row items-center space-x-2 border-b border-neutral-300 pb-3 dark:border-neutral-700/40 md:mt-0 md:flex-col md:space-x-0 md:space-y-1"
2023-03-19 16:44:15 +00:00
>
2023-03-15 11:24:26 +00:00
<a
href="https://github.com/pheralb/svgl#-getting-started"
target="_blank"
2023-03-20 10:39:17 +00:00
class="flex w-full items-center space-x-2 rounded-md p-2 duration-100 hover:bg-neutral-200 dark:hover:bg-neutral-700/40"
2023-03-15 11:24:26 +00:00
>
<span>Submit logo</span>
2023-05-11 08:03:58 +00:00
<div><ArrowUpRight size={16} /></div>
2023-03-15 11:24:26 +00:00
</a>
<a
2023-03-20 20:37:55 +00:00
href="https://github.com/pheralb/svgl"
2023-03-15 11:24:26 +00:00
target="_blank"
2023-03-20 10:39:17 +00:00
class="flex w-full items-center space-x-2 rounded-md p-2 duration-100 hover:bg-neutral-200 dark:hover:bg-neutral-700/40"
2023-03-15 11:24:26 +00:00
>
2023-05-11 08:03:58 +00:00
<div class="flex items-center space-x-2">
<span class="flex items-center justify-center">Repository</span>
2023-05-10 17:06:42 -03:00
{#if data.stars}
2023-07-07 10:08:56 +01:00
<div class="flex items-center space-x-1 text-neutral-600 dark:text-neutral-400">
<div>
<Star size={14} weight="duotone" class="text-yellow-700 dark:text-yellow-500" />
</div>
2023-05-11 08:03:58 +00:00
<span>{data.stars}</span>
</div>
2023-05-10 17:06:42 -03:00
{/if}
2023-05-11 08:03:58 +00:00
<div><ArrowUpRight size={16} /></div>
</div>
</a>
2023-03-15 11:24:26 +00:00
</div>
2023-03-15 13:54:56 +00:00
<a
href="https://twitter.com/pheralb_"
target="_blank"
2023-03-20 10:39:17 +00:00
class="mt-5 flex 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>
<ArrowUpRight size={12} />
</div>
</a>
2023-03-15 11:24:26 +00:00
</div>
</nav>
2023-03-19 16:44:15 +00:00
<div class="py-2 md:ml-60 md:py-6">
2023-03-19 20:22:58 +00:00
{#if data.pathname !== '/'}
<Container>
<a href="/">
<div
2023-03-22 09:21:15 +00:00
class="flex items-center space-x-2 duration-100 hover:text-neutral-500 dark:text-neutral-400 dark:hover:text-white"
2023-03-19 20:22:58 +00:00
>
<ArrowLeft size={20} />
2023-03-26 22:39:32 +01:00
<span>View all</span>
2023-03-19 20:22:58 +00:00
</div>
</a>
</Container>
{/if}
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={{
class:
'font-sans dark:bg-neutral-800 dark:text-white bg-neutral-200 text-neutral-800 border dark:border-neutral-900 border-neutral-300'
}}
/>
2023-03-15 11:24:26 +00:00
</div>
</main>