added quote to main page
This commit is contained in:
@@ -1,31 +1,40 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { onMount } from "svelte";
|
||||||
import Content from "$lib/content.svelte";
|
import Content from "$lib/content.svelte";
|
||||||
import GamedevWebring from "$lib/webrings/gamedev.svelte";
|
import GamedevWebring from "$lib/webrings/gamedev.svelte";
|
||||||
import Gallery from "$lib/lists/gallery-entry.svelte";
|
import Gallery from "$lib/lists/gallery-entry.svelte";
|
||||||
import LinkList from "$lib/link-list.svelte";
|
import LinkList from "$lib/link-list.svelte";
|
||||||
|
import { quotes, type Quote } from "./quotes";
|
||||||
|
|
||||||
import { posts } from "$lib/devlog-posts";
|
import { posts } from "$lib/devlog-posts";
|
||||||
|
|
||||||
var lastIndex = -1;
|
var lastIndex = -1;
|
||||||
let meImg: string = "common/me/a.webp";
|
let meImg: string = $state("common/me/a.webp");
|
||||||
|
let marqueeQuote: Quote = $state({
|
||||||
|
author: "",
|
||||||
|
content: "",
|
||||||
|
source: "",
|
||||||
|
});
|
||||||
|
|
||||||
$: setPicture();
|
onMount(() => {
|
||||||
|
setPicture();
|
||||||
|
setMarqueeText();
|
||||||
|
});
|
||||||
|
|
||||||
function getRandom(to: number): number {
|
function getRandom(max: number): number {
|
||||||
var buf = new Uint8Array(1);
|
return Math.floor(Math.random() * max);
|
||||||
crypto.getRandomValues(buf);
|
|
||||||
if (buf[0] % to == lastIndex) {
|
|
||||||
return getRandom(to);
|
|
||||||
}
|
|
||||||
lastIndex = buf[0] % to;
|
|
||||||
return buf[0] % to;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let setPicture = function() {
|
let setPicture = function() {
|
||||||
var pictures = ["a", "b", "c", "e"];
|
var pictures = ["a", "b", "c", "e"];
|
||||||
var selectedPicture = pictures[getRandom(pictures.length)];
|
var selectedPicture = pictures[getRandom(pictures.length)];
|
||||||
meImg = "common/me/" + selectedPicture + ".webp";
|
meImg = "common/me/" + selectedPicture + ".webp";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let setMarqueeText = function() {
|
||||||
|
marqueeQuote = quotes[getRandom(quotes.length)];
|
||||||
|
};
|
||||||
|
|
||||||
let latestDevlogDate = posts[0].date.substring(0, 7).replace("/", "-") + "-" + posts[0].date.substring(7);
|
let latestDevlogDate = posts[0].date.substring(0, 7).replace("/", "-") + "-" + posts[0].date.substring(7);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -66,6 +75,11 @@
|
|||||||
]}/>
|
]}/>
|
||||||
</div>
|
</div>
|
||||||
<div class="subcontainer">
|
<div class="subcontainer">
|
||||||
|
<div class="quote-marquee-container">
|
||||||
|
{@render marqueeContent({quote: marqueeQuote, ignoreA11y: false})}
|
||||||
|
{@render marqueeContent({quote: marqueeQuote, ignoreA11y: true})}
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>about ↬<img id="me-img" class="me-img" title="hi there" src={meImg} alt="Deniz, the website developer, small and pixelated">↫ me </h3>
|
<h3>about ↬<img id="me-img" class="me-img" title="hi there" src={meImg} alt="Deniz, the website developer, small and pixelated">↫ me </h3>
|
||||||
|
|
||||||
<p>Hi! I'm Deniz. I'm a programmer, sometimes a music producer, and rarely a hard-working student in Northern Germany. Welcome to my webpage!</p>
|
<p>Hi! I'm Deniz. I'm a programmer, sometimes a music producer, and rarely a hard-working student in Northern Germany. Welcome to my webpage!</p>
|
||||||
@@ -97,6 +111,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
||||||
|
{#snippet marqueeContent({quote, ignoreA11y}: {quote: Quote, ignoreA11y: boolean})}
|
||||||
|
<span class="quote-marquee" aria-hidden="{ignoreA11y}"><i>{quote.content}</i> – {quote.author} [{quote.source}] ***</span>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -121,4 +139,35 @@
|
|||||||
-webkit-text-fill-color: transparent;
|
-webkit-text-fill-color: transparent;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quote-marquee-container {
|
||||||
|
width: 100%;
|
||||||
|
background-color: var(--color-background-highlight);
|
||||||
|
display: flex;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-marquee {
|
||||||
|
animation: marquee-content 10s linear infinite;
|
||||||
|
font-family: 'Space Mono';
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 6px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-marquee-container:hover .quote-marquee {
|
||||||
|
animation-play-state: paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes marquee-content {
|
||||||
|
/* Element one fully ON screen at left-edge of container. */
|
||||||
|
from {
|
||||||
|
transform: translateX( 0% );
|
||||||
|
}
|
||||||
|
/* Element one fully OFF screen (just beyond left-ledge of container). */
|
||||||
|
to {
|
||||||
|
transform: translateX( -100% );
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -2,7 +2,6 @@ export interface Quote {
|
|||||||
content: string;
|
content: string;
|
||||||
author: string;
|
author: string;
|
||||||
source: string;
|
source: string;
|
||||||
link: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export let quotes: Quote[] = [
|
export let quotes: Quote[] = [
|
||||||
@@ -10,12 +9,15 @@ export let quotes: Quote[] = [
|
|||||||
content: "If you live a life in letters you might never really feel alive",
|
content: "If you live a life in letters you might never really feel alive",
|
||||||
author: "Pierce Fulton",
|
author: "Pierce Fulton",
|
||||||
source: "Life in Letters",
|
source: "Life in Letters",
|
||||||
link: "https://youtu.be/qIXK5hc7DNQ",
|
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// content: "",
|
content: "Life's a game made for everyone, and love is the prize",
|
||||||
// author: "",
|
author: "Avicii & Aloe Blacc",
|
||||||
// source: "",
|
source: "Wake Me Up",
|
||||||
// link: "",
|
},
|
||||||
// },
|
{
|
||||||
|
content: "We've come a long way since that day, and we will never look back at the faded silhouette",
|
||||||
|
author: "Avicii & Salem Al Fakir",
|
||||||
|
source: "Silhouettes",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
Reference in New Issue
Block a user