feat: some shit

This commit is contained in:
2024-04-03 18:54:51 +02:00
parent 1b86c44244
commit aea14aa471
43 changed files with 70 additions and 81 deletions

View File

@@ -3,13 +3,14 @@ import markdownToText from "@helpers/markdownToText";
import { Card } from "./card"; import { Card } from "./card";
import { useTranslatedPath, useTranslations } from "@i18n/utils"; import { useTranslatedPath, useTranslations } from "@i18n/utils";
import Image from "@components/Image.astro"; import Image from "@components/Image.astro";
import type { ImageMetadata } from "astro";
interface Props { interface Props {
post: { post: {
data: { data: {
title: string; title: string;
icon?: string; icon?: string;
headerImg?: string; cover?: ImageMetadata;
}; };
collection: string; collection: string;
slug: string; slug: string;
@@ -18,7 +19,7 @@ interface Props {
} }
const { const {
data: { title, headerImg, icon }, data: { title, cover, icon },
collection, collection,
body, body,
slug, slug,
@@ -27,15 +28,11 @@ const {
const translatePath = useTranslatedPath(Astro.url); const translatePath = useTranslatedPath(Astro.url);
const t = useTranslations(Astro.url); const t = useTranslations(Astro.url);
const imagePath = `../content/${collection}/${slug.split("/")[0]}/${headerImg}`;
const image = headerImg && (await import(imagePath)).default;
const link = translatePath(`/${collection}/${slug.split("/")[0]}`); const link = translatePath(`/${collection}/${slug.split("/")[0]}`);
--- ---
<Card <Card
classes={`grid gradient border-1 border-neutral overflow-hidden ${image ? "grid-rows-[200px_1fr] sm:grid-rows-none sm:grid-cols-[1fr_200px]" : ""}`} classes={`grid gradient border-1 border-neutral overflow-hidden ${cover ? "grid-rows-[200px_1fr] sm:grid-rows-none sm:grid-cols-[1fr_200px]" : ""}`}
> >
<Card.Content classes="px-8 py-7 order-last sm:order-first"> <Card.Content classes="px-8 py-7 order-last sm:order-first">
<Card.Title classes="text-4xl flex items-center gap-2"> <Card.Title classes="text-4xl flex items-center gap-2">
@@ -48,10 +45,10 @@ const link = translatePath(`/${collection}/${slug.split("/")[0]}`);
<Card.ReadMoreButton link={link} text={t("read-more")} /> <Card.ReadMoreButton link={link} text={t("read-more")} />
</Card.Content> </Card.Content>
{ {
image?.format && ( cover && (
<a href={link}> <a href={link}>
<Image <Image
src={image} src={cover}
alt={"cover for " + title} alt={"cover for " + title}
class="right-0 h-full object-cover object-center rounded-none border-l border-neutral" class="right-0 h-full object-cover object-center rounded-none border-l border-neutral"
/> />

View File

@@ -2,11 +2,7 @@
import { onMount } from "svelte"; import { onMount } from "svelte";
import { writable } from "svelte/store"; import { writable } from "svelte/store";
let theme = writable("light"); let theme = writable("");
onMount(() => {
theme.set(localStorage.getItem("theme") || "light");
});
$: if ($theme && "document" in globalThis) { $: if ($theme && "document" in globalThis) {
document.documentElement.classList.remove("light", "dark"); document.documentElement.classList.remove("light", "dark");
@@ -15,9 +11,12 @@
} }
function toggleTheme() { function toggleTheme() {
console.log($theme);
theme.update((t) => (t === "light" ? "dark" : "light")); theme.update((t) => (t === "light" ? "dark" : "light"));
} }
onMount(() => {
theme.set(localStorage.getItem("theme") || "dark");
});
</script> </script>
<button class="block w-6 h-6" on:click={toggleTheme} title="toggle dark mode"> <button class="block w-6 h-6" on:click={toggleTheme} title="toggle dark mode">

View File

@@ -1,7 +1,7 @@
--- ---
title: "Alpine Valley" title: "Alpine Valley"
date: 2016-12-22 date: 2016-12-22
headerImg: "images/Render.png" cover: ./images/Render.png
comments: true comments: true
--- ---
import Image from "@components/Image.astro"; import Image from "@components/Image.astro";

View File

@@ -1,7 +1,7 @@
--- ---
title: "Alpine Valley" title: Alpine Valley
date: 2016-12-22 date: 2016-12-22
headerImg: "images/Render.png" cover: ./images/Render.png
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Random Renders NO°2" title: Random Renders NO°2
date: 2023-05-11 date: 2023-05-11
headerImg: "images/palma.png" cover: ./images/palma.png
featured: true featured: true
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Random Renders NO°2" title: Random Renders NO°2
date: 2023-05-11 date: 2023-05-11
headerImg: "images/palma.png" cover: ./images/palma.png
featured: true featured: true
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Random Renders NO°1" title: "Random Renders NO°1"
date: 2018-12-30 date: 2018-12-30
headerImg: "images/myown.png" cover: ./images/myown.png
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Random Renders NO°1" title: "Random Renders NO°1"
date: 2018-12-30 date: 2018-12-30
headerImg: "images/myown.png" cover: ./images/myown.png
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Sketche 01" title: "Sketche 01"
date: 2017-05-08 date: 2017-05-08
headerImg: "images/Baakk.jpg" cover: ./images/Baakk.jpg
--- ---
import Image from "@components/Image.astro"; import Image from "@components/Image.astro";

View File

@@ -1,7 +1,7 @@
--- ---
title: "Sketche 01" title: "Sketche 01"
date: 2017-05-08 date: 2017-05-08
headerImg: "images/Baakk.jpg" cover: ./images/Baakk.jpg
--- ---
import Image from "@components/Image.astro"; import Image from "@components/Image.astro";

View File

@@ -1,7 +1,7 @@
--- ---
title: "Speed_Scene_03" title: "Speed_Scene_03"
date: 2017-02-03 date: 2017-02-03
headerImg: "images/Render_04.png" cover: ./images/Render_04.png
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Speed_Scene_03" title: Speed_Scene_03
date: 2017-02-03 date: 2017-02-03
headerImg: "images/Render_04.png" cover: ./images/Render_04.png
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Speed_Scene_04/05" title: "Speed_Scene_04/05"
date: 2017-03-13 date: 2017-03-13
headerImg: "Render_01.jpg" cover: ./images/Render_01.jpg
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Speed_Scene_04/05" title: "Speed_Scene_04/05"
date: 2017-03-13 date: 2017-03-13
headerImg: "Render_01.jpg" cover: ./images/Render_01.jpg
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Station B3-4 Offline" title: "Station B3-4 Offline"
date: 2016-12-21 date: 2016-12-21
headerImg: "Station.jpg" cover: ./images/Station.jpg
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Station B3-4 Offline" title: "Station B3-4 Offline"
date: 2016-12-21 date: 2016-12-21
headerImg: "Station.jpg" cover: ./images/Station.jpg
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Surfirvorcamp | Esmoriz" title: "Surfirvorcamp | Esmoriz"
date: 2017-04-18 date: 2017-04-18
headerImg: "MAX_4978.jpg" cover: ./images/MAX_4978.jpg
comments: true comments: true
--- ---
import YouTube from "@components/YouTube.astro"; import YouTube from "@components/YouTube.astro";

View File

@@ -1,7 +1,7 @@
--- ---
title: "The End" title: "The End"
date: 2017-02-02 date: 2017-02-02
headerImg: "Render_01.jpg" cover: ./images/Render_01.jpg
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "WebGL Showcase" title: "WebGL Showcase"
date: 2018-01-03 date: 2018-01-03
headerImg: "images/Bildschirmfoto-2018-01-03-um-13.09.42-2.png" cover: ./images/Bildschirmfoto-2018-01-03-um-13.09.42-2.png
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Workroom No°2" title: "Workroom No°2"
date: 2017-05-26 date: 2017-05-26
headerImg: "images/untitled7.png" cover: ./images/untitled7.png
comments: true comments: true
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
title: "Workroom" title: "Workroom"
date: 2017-05-22 date: 2017-05-22
headerImg: "images/untitled4.png" cover: ./images/untitled4.png
comments: true comments: true
--- ---

View File

@@ -1,10 +1,13 @@
import { defineCollection, z } from 'astro:content'; import { defineCollection, z } from 'astro:content';
const blogCollection = defineCollection({ const blogCollection = defineCollection({
schema: z.object({ schema: ({ image }) => z.object({
title: z.string(), title: z.string(),
date: z.date(), date: z.date(),
headerImg: z.string().optional(), cover: image().refine((img) => img.width >= 720, {
message: "Cover image must be at least 720 pixels wide!",
}).optional(),
coverAlt: z.string().optional(),
description: z.string().optional(), description: z.string().optional(),
icon: z.string().optional(), icon: z.string().optional(),
draft: z.boolean().optional(), draft: z.boolean().optional(),

BIN
src/content/photos/bigge-changes/index.mdx (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
src/content/photos/portugal-2021/index.mdx (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,7 +1,7 @@
--- ---
title: "Invoice" title: "Invoice"
date: 2023-08-21 date: 2023-08-21
headerImg: "bg.jpg" cover: ./images/bg.jpg
icon: "/projects/invoice.svg" icon: "/projects/invoice.svg"
tags: ["sveltekit", "unocss", "prisma", "sqlite"] tags: ["sveltekit", "unocss", "prisma", "sqlite"]
draft: true draft: true

View File

@@ -1,7 +1,7 @@
--- ---
title: "K.A.R.L" title: "K.A.R.L"
date: 2021-04-01 date: 2021-04-01
headerImg: "images/Indicatrices_of_Distortion.png" cover: ./images/Indicatrices_of_Distortion.png
license: "CC-BY-SA:4.0" license: "CC-BY-SA:4.0"
comments: true comments: true
links: links:

View File

@@ -1,7 +1,7 @@
--- ---
title: "Modern" title: "Modern"
date: 2020-06-09T11:55:24+02:00 date: 2020-06-09T11:55:24+02:00
headerImg: "images/screenshot.png" cover: ./images/screenshot.png
links: links:
[ [
["live", "https://max-richter.dev/modern?scene=modern"], ["live", "https://max-richter.dev/modern?scene=modern"],

View File

@@ -1,7 +1,7 @@
--- ---
title: "Plantarium" title: "Plantarium"
date: 2022-08-31 date: 2022-08-31
headerImg: "images/plantarium.png" cover: ./images/plantarium.png
featured: true featured: true
links: [["website", "https://plant.max-richter.com"], ["git", "https://github.com/jim-fx/plantarium"]] links: [["website", "https://plant.max-richter.com"], ["git", "https://github.com/jim-fx/plantarium"]]
draft: true draft: true

View File

@@ -1,7 +1,7 @@
--- ---
title: "Plantarium" title: "Plantarium"
date: 2022-08-31T20:46:26+02:00 date: 2022-08-31T20:46:26+02:00
headerImg: "images/plantarium.png" cover: ./images/plantarium.png
featured: true featured: true
links: [["website", "https://plant.max-richter.dev"], ["git", "https://github.com/jim-fx/plantarium"]] links: [["website", "https://plant.max-richter.dev"], ["git", "https://github.com/jim-fx/plantarium"]]
tags: ["Web", "3D", "Svelte", "Node-Systeme"] tags: ["Web", "3D", "Svelte", "Node-Systeme"]

View File

@@ -57,12 +57,13 @@ const { title, width = "compact" } = Astro.props;
<script> <script>
(function () { (function () {
try { try {
var mode = localStorage.getItem("mode"); var mode = localStorage.getItem("theme");
var supportDarkMode = var supportDarkMode =
window.matchMedia("(prefers-color-scheme: dark)").matches === true; window.matchMedia("(prefers-color-scheme: dark)").matches === true;
if (!mode && supportDarkMode) if (!mode && supportDarkMode)
document.documentElement.classList.add("dark"); document.documentElement.classList.add("dark");
if (!mode) return; if (!mode) return;
console.log({ mode });
document.documentElement.classList.add(mode); document.documentElement.classList.add(mode);
} catch (e) {} } catch (e) {}
})(); })();

View File

@@ -12,21 +12,7 @@ const locale = getLocale(Astro.url);
const posts = filterCollection(pages, locale); const posts = filterCollection(pages, locale);
const featuredPosts = await Promise.all( const featuredPosts = posts.slice(0, 3);
posts.slice(0, 3).map(async (post) => {
if (!post.data.headerImg) {
return post;
}
const { default: image } = await import(
`../../content/blog/${post.slug.split("/")[0]}/${post.data.headerImg}`
);
return {
...post,
image,
};
}),
);
const otherPosts = posts.slice(3); const otherPosts = posts.slice(3);
--- ---

View File

@@ -12,6 +12,9 @@
"@components/*": [ "@components/*": [
"src/components/*" "src/components/*"
], ],
"@content/*": [
"src/content/*"
],
"@helpers/*": [ "@helpers/*": [
"src/helpers/index.ts", "src/helpers/index.ts",
"src/helpers/*" "src/helpers/*"