Skip to content

Commit

Permalink
Add random header image and new favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
Mystler committed Sep 13, 2024
1 parent c395ffb commit 385ab09
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare global {
interface PageData {
title?: string;
description?: string;
titleImage?: string;
}
// interface PageState {}
// interface Platform {}
Expand Down
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
Expand Down
24 changes: 18 additions & 6 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { PageDescription, PageTitle } from "$lib/page-meta";
import AudioPlayer from "$lib/components/AudioPlayer.svelte";
import { GlobalAudioCurrentSong, GlobalAudioPlayer } from "$lib/audioplayer";
import { slide } from "svelte/transition";
// Update title and description stores based on page data
// unless we expect MarkdownContent to do it in md-pages.
Expand Down Expand Up @@ -40,12 +41,23 @@
<div class="flex flex-col min-h-screen">
<Header />

<div class="site-content grow px-4 py-4 flex justify-center gap-4 flex-col lg:flex-row">
<main class="grow lg:max-w-screen-xl">
<slot />
</main>
<div class="flex-none lg:w-72 lg:sticky lg:self-start lg:top-[76px]">
<Sidebar />
<div class="site-content grow px-4 py-4">
{#if $page.data.titleImage}
<div transition:slide class="mb-4">
<img
class="mx-auto rounded-xl border-2 border-zinc-800"
src={$page.data.titleImage}
alt="Mystler.eu"
/>
</div>
{/if}
<div class="flex justify-center gap-4 flex-col lg:flex-row">
<main class="grow lg:max-w-screen-xl">
<slot />
</main>
<div class="flex-none lg:w-72 lg:sticky lg:self-start lg:top-[76px]">
<Sidebar />
</div>
</div>
</div>

Expand Down
15 changes: 14 additions & 1 deletion src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import { browser } from "$app/environment";
import { fetchPosts } from "$lib/posts";
import type { PageLoad } from "./$types";

const titleImages = [
"/img/header_01.webp",
"/img/header_02.webp",
"/img/header_03.webp",
"/img/header_04.webp",
"/img/header_05.webp",
"/img/header_06.webp",
];

export const load: PageLoad = async () => {
return { page: await fetchPosts(0) };
return {
page: await fetchPosts(0),
titleImage: browser && titleImages[Math.floor(Math.random() * titleImages.length)],
};
};
Binary file removed static/favicon.ico
Binary file not shown.
Binary file added static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/header_01.webp
Binary file not shown.
Binary file added static/img/header_02.webp
Binary file not shown.
Binary file added static/img/header_03.webp
Binary file not shown.
Binary file added static/img/header_04.webp
Binary file not shown.
Binary file added static/img/header_05.webp
Binary file not shown.
Binary file added static/img/header_06.webp
Binary file not shown.

0 comments on commit 385ab09

Please sign in to comment.