178 lines
4.1 KiB
Svelte
178 lines
4.1 KiB
Svelte
<script lang="ts">
|
|
import { routes } from "$lib/sitemap.ts"
|
|
import { Separator } from "$lib/components/ui/separator/index.js";
|
|
import { Rss } from "lucide-svelte";
|
|
let scrollPosition: number = .5;
|
|
let scrollHeight: number = 1;
|
|
let progress: number = 0;
|
|
|
|
function onScroll() {
|
|
if (scrollHeight > 1) {
|
|
progress = Math.max(0, Math.min(1, scrollPosition / scrollHeight));
|
|
}
|
|
}
|
|
|
|
import type { PageData } from './$types';
|
|
export let data: PageData;
|
|
const { name, Content } = data;
|
|
|
|
import metadata from '$content/metadata.json';
|
|
const iconMap: Map<string, string> = {
|
|
"bitbucket": "fa-brands fa-bitbucket",
|
|
"discord": "fa-brands fa-discord",
|
|
"email": "fa-solid fa-envelope",
|
|
"github": "fa-brands fa-github",
|
|
"gitlab": "fa-brands fa-gitlab",
|
|
"google-scholar": "fa-brands fa-google-scholar",
|
|
"instagram": "fa-brands fa-instagram",
|
|
"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]);
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<title>{metadata.name}</title>
|
|
</svelte:head>
|
|
|
|
<div
|
|
id="background"
|
|
style="opacity: {1 - progress}; background-image: url('{metadata.frontCover}')"
|
|
>
|
|
</div>
|
|
|
|
<div id="front">
|
|
<div id="floater">
|
|
<p class="text-2xl floater-elem" style="color: #888">{metadata.frontDescription}</p>
|
|
<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>
|
|
<Separator class="bg-gray-500 dark:bg-gray-100" orientation="vertical" />
|
|
{#each routes as item}
|
|
{#if item.route !== "/"}
|
|
<a href={item.route} class:disabled-link={item.disabled}>{item.name}</a>
|
|
<Separator class="bg-gray-500 dark:bg-gray-100" orientation="vertical" />
|
|
{/if}
|
|
{/each}
|
|
<a class="icon" href="/rss.xml"><Rss /></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<main>
|
|
<div id="bio" class="bg-background">
|
|
<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} />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<article id="bio-core" class="prose lg:prose-xl dark:prose-invert">
|
|
<Content />
|
|
</article>
|
|
</div>
|
|
</main>
|
|
|
|
<svelte:window
|
|
bind:scrollY={scrollPosition}
|
|
bind:innerHeight={scrollHeight}
|
|
on:scroll={onScroll}
|
|
/>
|
|
|
|
<style>
|
|
#background {
|
|
background-attachment: fixed;
|
|
background-size: cover;
|
|
background-repeat: no-repeat;
|
|
background-position: center center;
|
|
z-index: -10;
|
|
position: fixed;
|
|
min-width: 100%;
|
|
min-height: 100%;
|
|
overscroll-behaviour: none;
|
|
}
|
|
#front {
|
|
height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
overscroll-behavior: none;
|
|
}
|
|
#floater {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
margin-top: auto;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
#navbar {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
}
|
|
.floater-elem {
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
main {
|
|
width: 100%;
|
|
@apply bg-background;
|
|
box-shadow:
|
|
0px -5px 10px 10px rgba(200,200,200,0.4);
|
|
}
|
|
#bio {
|
|
max-width: max(50vw, 100vh);
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
padding: 20px 10px 50px 10px;
|
|
min-height: 100vh;
|
|
}
|
|
#bio-name {
|
|
font-family: serif;
|
|
font-size: min(10vw, 60px);
|
|
display: inline-block;
|
|
color: theme('colors.java.800');
|
|
}
|
|
#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%;
|
|
@apply ml-auto mr-0;
|
|
}
|
|
#avatar-img {
|
|
min-height: 100%;
|
|
min-width: 100%;
|
|
object-fit: cover;
|
|
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;
|
|
}
|
|
</style>
|