feat: Vertical navbar and blog layout
This commit is contained in:
parent
2564ee4c2e
commit
f3f7890962
|
@ -81,5 +81,6 @@
|
||||||
}
|
}
|
||||||
html {
|
html {
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
|
overscroll-behavior: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ Here is some placeholder text
|
||||||
### 3rd level heading
|
### 3rd level heading
|
||||||
#### 4th level heading
|
#### 4th level heading
|
||||||
|
|
||||||
|
Markdown `inline code`
|
||||||
|
|
||||||
> This is a quote
|
> This is a quote
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
export const routes: { route: string, name: string, inactive?: boolean }[] = [
|
||||||
|
{ route: "/", name: "Home" },
|
||||||
|
{ route: "/post", name: "Blog" },
|
||||||
|
{ route: "/art", name: "Art", inactive: true },
|
||||||
|
{ route: "/archives", name: "Archives" },
|
||||||
|
];
|
|
@ -1,30 +1,33 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import '../app.css';
|
import '../app.css';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { Separator } from "$lib/components/ui/separator/index.js";
|
|
||||||
import Footer from "./Footer.svelte";
|
import Footer from "./Footer.svelte";
|
||||||
import { routes } from "./sitemap.ts"
|
import Navbar from "./Navbar.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Homepage has its own navbar with animations -->
|
<!-- Homepage has its own navbar with animations -->
|
||||||
{#if $page.url.pathname != "/"}
|
{#if $page.url.pathname != "/"}
|
||||||
<div id="navbar">
|
<div id="layout">
|
||||||
<div class="flex h-5 items-center space-x-4 text-sm">
|
<div id="navbar">
|
||||||
{#each routes as item, i}
|
<Navbar />
|
||||||
{#if i > 0}
|
</div>
|
||||||
<Separator orientation="vertical" />
|
<div id="content">
|
||||||
{/if}
|
<slot />
|
||||||
<a class="navbar-link" class:active-link={item.route === $page.url.pathname} href={item.route}>{item.name}</a>
|
|
||||||
{/each}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{:else}
|
||||||
|
<slot />
|
||||||
{/if}
|
{/if}
|
||||||
<slot />
|
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
:global(.navbar-link) {
|
:global(.navbar-link) {
|
||||||
@apply text-lg;
|
@apply text-lg;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: serif;
|
||||||
|
}
|
||||||
|
:global(p.navbar-link) {
|
||||||
|
color: rgb(128,128,128);
|
||||||
}
|
}
|
||||||
:global(a) {
|
:global(a) {
|
||||||
color: theme('colors.eucalyptus.400');
|
color: theme('colors.eucalyptus.400');
|
||||||
|
@ -34,10 +37,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
:global(a):not(.icon) {
|
:global(a):not(.icon) {
|
||||||
font-weight: 500;
|
|
||||||
text-decoration: inherit;
|
|
||||||
font-family: serif;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
text-decoration: inherit;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: "";
|
content: "";
|
||||||
|
@ -61,9 +62,29 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#navbar {
|
#layout {
|
||||||
|
max-width: max(80vw, 100vh);
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
margin-top: 50px;
|
||||||
|
gap: 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
/*
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 3fr;
|
||||||
|
grid-template-areas:
|
||||||
|
"nav content"
|
||||||
|
;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
#content {
|
||||||
|
width: max(50vw, 100vh);
|
||||||
|
grid-area: content;
|
||||||
|
}
|
||||||
|
#navbar {
|
||||||
|
align-self: right;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
grid-area: nav;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { routes } from "./sitemap.ts"
|
import { routes } from "$lib/sitemap.ts"
|
||||||
import { Separator } from "$lib/components/ui/separator/index.js";
|
import { Separator } from "$lib/components/ui/separator/index.js";
|
||||||
let scrollPosition: number = .5;
|
let scrollPosition: number = .5;
|
||||||
let scrollHeight: number = 1;
|
let scrollHeight: number = 1;
|
||||||
|
@ -17,11 +17,15 @@
|
||||||
|
|
||||||
import metadata from '$content/metadata.json';
|
import metadata from '$content/metadata.json';
|
||||||
const iconMap: Map<string, string> = {
|
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",
|
"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",
|
"open-source": "fa-brands fa-osi",
|
||||||
"orcid": "fa-brands fa-orcid",
|
"orcid": "fa-brands fa-orcid",
|
||||||
"instagram": "fa-brands fa-instagram",
|
|
||||||
"email": "fa-solid fa-envelope",
|
|
||||||
};
|
};
|
||||||
const iconLinks: [string, string][] = Object.entries(metadata.links).map(
|
const iconLinks: [string, string][] = Object.entries(metadata.links).map(
|
||||||
([key, link]) => [iconMap[key], link]);
|
([key, link]) => [iconMap[key], link]);
|
||||||
|
@ -39,7 +43,7 @@
|
||||||
|
|
||||||
<div id="front">
|
<div id="front">
|
||||||
<div id="floater">
|
<div id="floater">
|
||||||
<p class="text-lg floater-elem" style="color: #888">{metadata.frontDescription}</p>
|
<p class="text-2xl floater-elem" style="color: #888">{metadata.frontDescription}</p>
|
||||||
<div
|
<div
|
||||||
class="floater-elem"
|
class="floater-elem"
|
||||||
style="padding-bottom: {(1 - progress) * 50}vh"
|
style="padding-bottom: {(1 - progress) * 50}vh"
|
||||||
|
@ -49,7 +53,11 @@
|
||||||
{#each routes as item}
|
{#each routes as item}
|
||||||
{#if item.route !== "/"}
|
{#if item.route !== "/"}
|
||||||
<Separator orientation="vertical" />
|
<Separator orientation="vertical" />
|
||||||
<a class="navbar-link" href={item.route}>{item.name}</a>
|
{#if item.inactive ?? false}
|
||||||
|
<p class="navbar-link">{item.name}</p>
|
||||||
|
{:else}
|
||||||
|
<a class="navbar-link" href={item.route}>{item.name}</a>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
@ -127,7 +135,7 @@
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
#bio-name {
|
#bio-name {
|
||||||
font-family: serif;
|
font-family: serif;
|
||||||
font-size: 10vh;
|
font-size: 10vh;
|
||||||
line-height: 10vh;
|
line-height: 10vh;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
import { routes } from "$lib/sitemap.ts"
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="navbar" class="h-5 space-x-4 justify-between">
|
||||||
|
{#each routes as item}
|
||||||
|
{#if item.inactive ?? false}
|
||||||
|
<p class="navbar-link"
|
||||||
|
class:active-link={item.route === $page.url.pathname}
|
||||||
|
>{item.name}</p>
|
||||||
|
{:else}
|
||||||
|
<a class="navbar-link"
|
||||||
|
class:active-link={item.route === $page.url.pathname}
|
||||||
|
href={item.route}>{item.name}</a>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#navbar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -9,7 +9,7 @@
|
||||||
<title>{metadata.blogName}</title>
|
<title>{metadata.blogName}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<ul id="catalog">
|
<ul id="catalog" class="content">
|
||||||
{#each allPosts as post}
|
{#each allPosts as post}
|
||||||
<li id="post-item">
|
<li id="post-item">
|
||||||
<h2>
|
<h2>
|
||||||
|
@ -19,7 +19,11 @@
|
||||||
<p class="text-gray-500">{post.meta.description}</p>
|
<p class="text-gray-500">{post.meta.description}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
<p>tags?</p>
|
<p>
|
||||||
|
{#each (post.meta.tags ?? []) as tag}
|
||||||
|
<a href="/">{tag}</a>
|
||||||
|
{/each}
|
||||||
|
</p>
|
||||||
<p class="text-l text-gray-500">{post.meta.date}</p>
|
<p class="text-l text-gray-500">{post.meta.date}</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -33,9 +37,4 @@
|
||||||
#post-title {
|
#post-title {
|
||||||
@apply text-3xl;
|
@apply text-3xl;
|
||||||
}
|
}
|
||||||
#catalog {
|
|
||||||
max-width: max(50vw, 100vh);
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
export const routes: { route: string, name: string }[] = [
|
|
||||||
{ route: "/", name: "Home" },
|
|
||||||
{ route: "/post", name: "Blog" },
|
|
||||||
{ route: "/art", name: "Art" },
|
|
||||||
{ route: "/archives", name: "Archives" },
|
|
||||||
];
|
|
Loading…
Reference in New Issue