Site improvments #1

Merged
smjklake merged 5 commits from site-improvments into main 2024-11-13 08:12:20 -07:00
3 changed files with 120 additions and 103 deletions
Showing only changes of commit 92dcea5562 - Show all commits

View File

@@ -0,0 +1,7 @@
---
title: 'Mandelbrot Set rendered with OpenGL'
description: 'Rendering the Mandelbrot Set in OpenGL.'
pubDate: 'Dec 19 2024'
heroImage: 'https://placehold.co/600x400'
---

View File

@@ -1,111 +1,121 @@
--- ---
import BaseHead from '../../components/BaseHead.astro'; import BaseHead from "../../components/BaseHead.astro";
import Header from '../../components/Header.astro'; import Header from "../../components/Header.astro";
import Footer from '../../components/Footer.astro'; import Footer from "../../components/Footer.astro";
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts'; import { SITE_TITLE, SITE_DESCRIPTION } from "../../consts";
import { getCollection } from 'astro:content'; import { getCollection } from "astro:content";
import FormattedDate from '../../components/FormattedDate.astro'; import FormattedDate from "../../components/FormattedDate.astro";
import { Image } from "astro:assets";
const posts = (await getCollection('blog')).sort( const posts = (await getCollection("blog")).sort((a, b) =>
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() a.data.pubDate.valueOf() < b.data.pubDate.valueOf() ? 1 : -1,
); );
--- ---
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<style> <style>
main { main {
width: 960px; width: 960px;
} }
ul { ul {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 2rem; gap: 2rem;
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
ul li { ul li {
width: calc(50% - 1rem); width: calc(50% - 1rem);
} }
ul li * { ul li * {
text-decoration: none; text-decoration: none;
transition: 0.2s ease; transition: 0.2s ease;
} }
ul li:first-child { ul li:first-child {
width: 100%; width: 100%;
margin-bottom: 1rem; margin-bottom: 1rem;
text-align: center; text-align: center;
} }
ul li:first-child img { ul li:first-child img {
width: 100%; width: 100%;
} }
ul li:first-child .title { ul li:first-child .title {
font-size: 2.369rem; font-size: 2.369rem;
} }
ul li img { ul li img {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
border-radius: 12px; border-radius: 12px;
} }
ul li a { ul li a {
display: block; display: block;
} }
.title { .title {
margin: 0; margin: 0;
color: white; color: white;
line-height: 1; line-height: 1;
} }
.date { .date {
margin: 0; margin: 0;
color: rgb(var(--gray-light)); color: rgb(var(--gray-light));
} }
ul li a:hover h4, ul li a:hover h4,
ul li a:hover .date { ul li a:hover .date {
color: rgb(var(--gray)); color: rgb(var(--gray));
} }
ul a:hover img { ul a:hover img {
box-shadow: var(--box-shadow); box-shadow: var(--box-shadow);
} }
@media (max-width: 720px) { @media (max-width: 720px) {
ul { ul {
gap: 0.5em; gap: 0.5em;
} }
ul li { ul li {
width: 100%; width: 100%;
text-align: center; text-align: center;
} }
ul li:first-child { ul li:first-child {
margin-bottom: 0; margin-bottom: 0;
} }
ul li:first-child .title { ul li:first-child .title {
font-size: 1.563em; font-size: 1.563em;
} }
} }
</style> </style>
</head> </head>
<body> <body>
<Header /> <Header />
<main> <main>
<section> <section>
<ul> <ul>
{ {
posts.map((post) => ( posts.map((post) => (
<li> <li>
<a href={`/blog/${post.slug}/`}> <a href={`/blog/${post.slug}/`}>
<img width={720} height={360} src={post.data.heroImage} alt="" /> {post.data.heroImage &&
<h4 class="title">{post.data.title}</h4> <Image
<p class="date"> width={720}
<FormattedDate date={post.data.pubDate} /> height={360}
</p> src={post.data.heroImage}
</a> loading=eager
</li> alt=""
)) />}
} <h4 class="title">{post.data.title}</h4>
</ul> <p class="date">
</section> <FormattedDate
</main> date={post.data.pubDate}
<Footer /> />
</body> </p>
</a>
</li>
))
}
</ul>
</section>
</main>
<Footer />
</body>
</html> </html>