fixed theming issues

This commit is contained in:
2026-03-26 00:26:07 +01:00
parent 6ba897d27f
commit 798552d16f
5 changed files with 84 additions and 42 deletions
+21 -8
View File
@@ -10,14 +10,26 @@ interface Post {
let posts: Post[] = [];
let error = '';
let siteConfig = {
welcome_title: "Welcome to my blog",
welcome_subtitle: "Thoughts on software, design, and building things with Rust and Astro."
};
try {
const response = await fetch(`${API_URL}/api/posts`);
if (response.ok) {
posts = await response.json();
const [postsRes, configRes] = await Promise.all([
fetch(`${API_URL}/api/posts`),
fetch(`${API_URL}/api/config`)
]);
if (postsRes.ok) {
posts = await postsRes.json();
} else {
error = 'Failed to fetch posts';
}
if (configRes.ok) {
siteConfig = await configRes.json();
}
} catch (e) {
const cause = (e as any)?.cause;
error = `Could not connect to backend at ${API_URL}: ${e instanceof Error ? e.message : String(e)}${cause ? ' (Cause: ' + (cause.message || cause.code || JSON.stringify(cause)) + ')' : ''}`;
@@ -25,6 +37,7 @@ try {
}
function formatSlug(slug: string) {
if (!slug) return '';
return slug
.split('-')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
@@ -36,10 +49,10 @@ function formatSlug(slug: string) {
<div class="space-y-6 md:space-y-8">
<section class="text-center py-6 md:py-12">
<h1 class="text-3xl md:text-5xl font-extrabold mb-3 md:mb-4 pb-2 md:pb-4 leading-tight bg-clip-text text-transparent bg-gradient-to-r from-mauve via-blue to-teal">
Welcome to my blog
{siteConfig.welcome_title}
</h1>
<p class="text-subtext1 text-base md:text-lg max-w-2xl mx-auto px-4 md:px-0">
Thoughts on software, design, and building things with Rust and Astro.
{siteConfig.welcome_subtitle}
</p>
</section>
@@ -49,9 +62,9 @@ function formatSlug(slug: string) {
{error}
</div>
)}
{posts.length === 0 && !error && (
<div class="glass p-8 md:p-12 text-center text-subtext0 text-sm md:text-base">
<div class="glass p-8 md:p-12 text-center text-subtext1 text-sm md:text-base">
<p>No posts found yet. Add some .md files to the data/posts directory!</p>
</div>
)}
@@ -63,7 +76,7 @@ function formatSlug(slug: string) {
<h2 class="text-xl md:text-3xl font-bold text-lavender group-hover:text-mauve transition-colors mb-2 md:mb-3">
{formatSlug(post.slug)}
</h2>
<p class="text-subtext1 text-sm md:text-base leading-relaxed line-clamp-3">
<p class="text-text text-sm md:text-base leading-relaxed line-clamp-3">
{post.excerpt || `Read more about ${formatSlug(post.slug)}...`}
</p>
</div>