- added josefine sans

- added some placeholder pages and routes-
    - added logic to render nav-items without submenus as <a>
This commit is contained in:
ChrQR 2024-04-06 11:22:20 +02:00
parent b975564cc9
commit 8088da8886
6 changed files with 38 additions and 16 deletions

View File

@ -3,6 +3,9 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>

View File

@ -1,6 +1,9 @@
<script>
import { fade } from "svelte/transition";
import "../app.css";
// Navigation links are generated based on this object
const nav = [
{
name: "index",
@ -20,11 +23,11 @@
},
{
name: "login",
subPages: []
subPages: [],
}
];
let selected = nav[0]; // keep track of the selected 'page' object (default to the about component since we must have local db connection established first)
let selected = nav[0]; // keep track of the selected 'page' object.
let intSelected = 0; // selected page index
// change the selected component (the event.originalTarget.id is not accessible in Chrome so switched to event.srcElement.id)
@ -34,19 +37,26 @@
}
</script>
<nav>
<div class="justify-items-center align-middle">
<ul>
{#each nav as main,i}
{#if i != 0}
<li class="nav-item inline-block"><button class={selected==nav[i] ? "nav-link font-bold p-2 ml-1" : "p-2 ml-1 nav-link"} on:click={changeComponent} id={i} >{main.name}</button></li>
<nav class="nav-container h-32 w-full">
<ul class="text-center">
{#each nav as main,i}
{#if i != 0}
{#if !nav[i].subPages[0]}
<li class="nav-item font-jose inline-block"><a href={main.name} class={selected==nav[i] ? "nav-link stroke-slate-700 text-2xl p-3" : "nav link text-2xl p-3"} on:click={changeComponent} id={i} >{main.name}</a></li>
{:else}
<li class="nav-item font-jose inline-block"><button class={selected==nav[i] ? "nav-link stroke-slate-700 text-2xl p-3" : "nav link text-2xl p-3"} on:click={changeComponent} id={i} >{main.name}</button></li>
{/if}
{/each}
<hr />
{/if}
{/each}
</ul>
<hr class="nav-divider max-w-xl h-0.5 border-0 mx-auto my-1 bg-black rounded md:my-1"/>
{#key selected}
<ul in:fade={{ delay: 250 }} out:fade={{ duration: 250 }} class="text-center h-4 my-1">
{#each selected.subPages as subPage}
<li class="sub-nav-item inline-block"><a class="sub-nav-link"href={subPage}>{subPage}</a></li>
<li class="sub-nav-item inline-block font-jose"><a class="sub-nav-link text-xl p-2"href={subPage}>{subPage}</a></li>
{/each}
</ul>
</div>
{/key}
</nav>
<slot />

View File

@ -1,2 +1,5 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
<div class="main-container w-2/4 mx-auto text-center">
<h1 class="text-xl">Welcome to my personal webpage</h1>
<p>My name is Christian and I live in Copenhagen. In my professional life, I recruit in product and engineering.
</p>
</div>

View File

@ -0,0 +1 @@
<h1>This is the about page</h1>

View File

@ -0,0 +1 @@
<h1>This is the login page</h1>

View File

@ -2,7 +2,11 @@
export default {
content: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {},
extend: {
fontFamily: {
"jose": ["Josefin Sans", "sans-serif"]
}
},
},
plugins: [],
}