Chrysoblog/src/routes/+page.svelte

178 lines
4.1 KiB
Svelte
Raw Normal View History

2024-09-13 17:00:03 -07:00
<script lang="ts">
2024-09-16 21:33:02 -07:00
import { routes } from "$lib/sitemap.ts"
2024-09-13 17:00:03 -07:00
import { Separator } from "$lib/components/ui/separator/index.js";
2024-10-11 01:25:09 -07:00
import { Rss } from "lucide-svelte";
2024-09-13 17:00:03 -07:00
let scrollPosition: number = .5;
let scrollHeight: number = 1;
let progress: number = 0;
function onScroll() {
2024-09-13 17:00:03 -07:00
if (scrollHeight > 1) {
progress = Math.max(0, Math.min(1, scrollPosition / scrollHeight));
2024-09-13 17:00:03 -07:00
}
}
import type { PageData } from './$types';
export let data: PageData;
const { name, Content } = data;
2024-09-14 00:59:54 -07:00
import metadata from '$content/metadata.json';
2024-09-14 18:06:29 -07:00
const iconMap: Map<string, string> = {
2024-09-16 21:33:02 -07:00
"bitbucket": "fa-brands fa-bitbucket",
"discord": "fa-brands fa-discord",
"email": "fa-solid fa-envelope",
2024-09-14 18:06:29 -07:00
"github": "fa-brands fa-github",
2024-09-16 21:33:02 -07:00
"gitlab": "fa-brands fa-gitlab",
"google-scholar": "fa-brands fa-google-scholar",
"instagram": "fa-brands fa-instagram",
2024-09-14 18:06:29 -07:00
"open-source": "fa-brands fa-osi",
"orcid": "fa-brands fa-orcid",
};
const iconLinks: [string, string][] = Object.entries(metadata.links).map(
([key, link]) => [iconMap[key], link]);
2024-09-13 17:00:03 -07:00
</script>
2024-09-14 00:59:54 -07:00
<svelte:head>
<title>{metadata.name}</title>
</svelte:head>
2024-09-13 17:00:03 -07:00
<div
id="background"
style="opacity: {1 - progress}; background-image: url('{metadata.frontCover}')"
2024-09-13 17:00:03 -07:00
>
</div>
<div id="front">
<div id="floater">
2024-09-16 21:33:02 -07:00
<p class="text-2xl floater-elem" style="color: #888">{metadata.frontDescription}</p>
2024-09-13 17:00:03 -07:00
<div
class="floater-elem"
style="padding-bottom: {(1 - progress) * 50}vh"
>
<div id="navbar" class="h-5 items-center space-x-4 text-sm">
<a href="#bio">Bio</a>
2024-10-11 01:34:53 -07:00
<Separator class="bg-gray-500 dark:bg-gray-100" orientation="vertical" />
2024-09-13 17:00:03 -07:00
{#each routes as item}
{#if item.route !== "/"}
<a href={item.route} class:disabled-link={item.disabled}>{item.name}</a>
2024-10-11 01:34:53 -07:00
<Separator class="bg-gray-500 dark:bg-gray-100" orientation="vertical" />
2024-09-13 17:00:03 -07:00
{/if}
{/each}
2024-10-11 01:25:09 -07:00
<a class="icon" href="/rss.xml"><Rss /></a>
2024-09-13 17:00:03 -07:00
</div>
</div>
</div>
</div>
2024-09-14 18:06:29 -07:00
2024-09-28 15:18:09 -07:00
<main>
<div id="bio" class="bg-background">
2024-09-14 18:06:29 -07:00
<div class="p-1">
<div class="flex">
<div id="info flex-col">
<p id="bio-name">{name}</p>
<div class="w-100">
{#each iconLinks as [cl, link]}
<a class="icon m-1" href={link}><i class="fa-xl {cl}"></i></a>
{/each}
</div>
</div>
<div id="avatar">
<img id="avatar-img" src={metadata.picture} alt={metadata.name} />
2024-09-14 18:06:29 -07:00
</div>
2024-09-14 15:48:25 -07:00
</div>
</div>
<article id="bio-core" class="prose lg:prose-xl dark:prose-invert">
2024-09-14 18:06:29 -07:00
<Content />
</article>
2024-09-14 00:59:54 -07:00
</div>
2024-09-28 15:18:09 -07:00
</main>
2024-09-13 17:00:03 -07:00
<svelte:window
bind:scrollY={scrollPosition}
bind:innerHeight={scrollHeight}
on:scroll={onScroll}
/>
<style>
#background {
background-attachment: fixed;
2024-09-19 09:36:50 -07:00
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
2024-09-13 17:00:03 -07:00
z-index: -10;
position: fixed;
min-width: 100%;
min-height: 100%;
overscroll-behaviour: none;
2024-09-13 17:00:03 -07:00
}
#front {
height: 100vh;
display: flex;
flex-direction: column;
overscroll-behavior: none;
2024-09-13 17:00:03 -07:00
}
#floater {
display: flex;
flex-direction: column;
justify-content: center;
margin-top: auto;
margin-left: auto;
margin-right: auto;
}
#navbar {
display: flex;
flex-wrap: wrap;
}
2024-09-13 17:00:03 -07:00
.floater-elem {
margin-left: auto;
margin-right: auto;
}
2024-09-28 15:18:09 -07:00
main {
2024-09-14 18:06:29 -07:00
width: 100%;
@apply bg-background;
2024-09-14 18:06:29 -07:00
box-shadow:
0px -5px 10px 10px rgba(200,200,200,0.4);
}
2024-09-14 00:59:54 -07:00
#bio {
2024-09-14 18:14:02 -07:00
max-width: max(50vw, 100vh);
2024-09-14 00:59:54 -07:00
margin-left: auto;
margin-right: auto;
padding: 20px 10px 50px 10px;
2024-09-14 00:59:54 -07:00
min-height: 100vh;
}
2024-09-16 21:33:02 -07:00
#bio-name {
2024-09-14 18:06:29 -07:00
font-family: serif;
font-size: min(10vw, 60px);
2024-09-14 15:48:25 -07:00
display: inline-block;
2024-09-14 18:06:29 -07:00
color: theme('colors.java.800');
2024-09-14 15:48:25 -07:00
}
#avatar {
line-height: 0;
display: inline-block;
margin: 5px;
margin-right: auto;
border: 4px solid theme('colors.eucalyptus.500');
border-radius: 50%;
aspect-ratio: 1;
max-width: 20%;
2024-09-14 15:48:25 -07:00
@apply ml-auto mr-0;
}
#avatar-img {
min-height: 100%;
min-width: 100%;
object-fit: cover;
2024-09-14 15:48:25 -07:00
border-radius: 50%;
}
#bio-core {
width: 100%;
}
#bio-core > :global(*):not(h1):not(h2) {
margin-left: 50px;
}
#bio-core > :global(h1) {
color: theme('colors.eucalyptus.700');
font-weight: normal;
border-bottom: 1px solid;
2024-09-14 00:59:54 -07:00
}
2024-09-13 17:00:03 -07:00
</style>