Blog: style blog page

This commit is contained in:
Akemi Izuko 2023-12-28 00:39:21 -07:00
parent a365ec04b6
commit 992462c0a0
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC
2 changed files with 119 additions and 97 deletions

View file

@ -30,7 +30,7 @@ import { SITE_TITLE } from '../consts';
<HeaderLink href="/about">About</HeaderLink> <HeaderLink href="/about">About</HeaderLink>
</div> </div>
<div class="fun-quote" style="margin: 0"> <div class="fun-quote" style="margin: 0">
<span style="font-family: PoetsenOne" class="text-2xl">ReLUwU activated</span> <span style="font-family: var(--font-title);" class="text-2xl">ReLUwU activated</span>
</div> </div>
<div class="social-links flex space-x-8 items-center"> <div class="social-links flex space-x-8 items-center">
<HeaderLink <HeaderLink

View file

@ -7,105 +7,127 @@ import { getCollection } from 'astro:content';
import FormattedDate from '../../components/FormattedDate.astro'; import FormattedDate from '../../components/FormattedDate.astro';
const posts = (await getCollection('blog')).sort( const posts = (await getCollection('blog')).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
); );
--- ---
<!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;
} margin: auto;
ul { }
display: flex;
flex-wrap: wrap; ul {
gap: 2rem; display: flex;
list-style-type: none; flex-wrap: wrap;
margin: 0; gap: 2rem;
padding: 0; list-style-type: none;
} margin: 0;
ul li { padding: 0;
width: calc(50% - 1rem); }
} ul li {
ul li * { width: calc(50% - 1rem);
text-decoration: none; }
transition: 0.2s ease; /*
} ul li * {
ul li:first-child { text-decoration: none;
width: 100%; transition: 0.2s ease;
margin-bottom: 1rem; }
text-align: center; ul li:first-child {
} width: 100%;
ul li:first-child img { margin-bottom: 1rem;
width: 100%; text-align: center;
} }
ul li:first-child .title { ul li:first-child img {
font-size: 2.369rem; width: 100%;
} }
ul li img { ul li:first-child .title {
margin-bottom: 0.5rem; font-size: 2.369rem;
border-radius: 12px; }
} ul li img {
ul li a { margin-bottom: 0.5rem;
display: block; border-radius: 12px;
} }
.title { ul li a {
margin: 0; display: block;
color: rgb(var(--black)); }
line-height: 1; .title {
} margin: 0;
.date { color: rgb(var(--black));
margin: 0; line-height: 1;
color: rgb(var(--gray)); }
} .date {
ul li a:hover h4, margin: 0;
ul li a:hover .date { color: rgb(var(--gray));
color: rgb(var(--accent)); }
} ul li a:hover h4,
ul a:hover img { ul li a:hover .date {
box-shadow: var(--box-shadow); color: rgb(var(--accent));
} }
@media (max-width: 720px) { ul a:hover img {
ul { box-shadow: var(--box-shadow);
gap: 0.5em; }
} */
ul li { @media (max-width: 720px) {
width: 100%; ul {
text-align: center; gap: 0.5em;
} }
ul li:first-child { ul li {
margin-bottom: 0; width: 100%;
} text-align: center;
ul li:first-child .title { }
font-size: 1.563em; ul li:first-child {
} margin-bottom: 0;
} }
</style> ul li:first-child .title {
</head> font-size: 1.563em;
<body> }
<Header /> }
<main> </style>
<section> </head>
<ul> <body>
{ <Header />
posts.map((post) => ( <main>
<li> <section>
<a href={`/blog/${post.slug}/`}> <h1
<img width={720} height={360} src={post.data.heroImage} alt="" /> class="text-center text-4xl"
<h4 class="title">{post.data.title}</h4> style="font-family: var(--font-title);">
<p class="date"> Blogs!
<FormattedDate date={post.data.pubDate} /> </h1>
</p> <p
</a> class="text-center m-6">
</li> A collection of tutorials and opinionated pieces. Have a
)) read!
} </p>
</ul> <ul>
</section> {
</main> posts.map((post) => (
<Footer /> <li>
</body> <a href={`/blog/${post.slug}/`}>
<img
width={720}
height={360}
class="rounded-2xl grayscale"
src={post.data.heroImage}
alt="" />
<h4
class="title text-xl">
{post.data.title}
</h4>
<p class="date">
<FormattedDate date={post.data.pubDate} />
</p>
</a>
</li>
))
}
</ul>
</section>
</main>
<Footer />
</body>
</html> </html>