Markdown: unify stylesheet for blog and unix listings

This commit is contained in:
Akemi Izuko 2023-12-30 03:13:05 -07:00
parent 311010aef9
commit 066952ae0b
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC
4 changed files with 68 additions and 82 deletions

View file

@ -6,6 +6,8 @@ import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
import { getCollection } from 'astro:content';
import FormattedDate from '../../components/FormattedDate.astro';
import "../../styles/post-listing.css"
const posts = (await getCollection('blog')).sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
);
@ -15,48 +17,10 @@ const posts = (await getCollection('blog')).sort(
<html lang="en">
<head>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<style>
main {
width: 960px;
margin: auto;
}
ul {
display: flex;
flex-wrap: wrap;
gap: 2rem;
list-style-type: none;
margin: 0;
padding: 0;
}
ul li {
width: calc(50% - 1rem);
}
img {
height: 232px;
width: 464px;
object-fit: contain;
}
@media (max-width: 720px) {
ul {
gap: 0.5em;
}
ul li {
width: 100%;
text-align: center;
}
ul li:first-child {
margin-bottom: 0;
}
ul li:first-child .title {
font-size: 1.563em;
}
}
</style>
</head>
<body>
<Header />
<main>
<main class="post-listing">
<section>
<h1
class="text-center mt-8 mb-4 text-6xl"
@ -80,6 +44,9 @@ const posts = (await getCollection('blog')).sort(
class="rounded-2xl grayscale"
src={post.data.heroImage}
alt="" />
<div class="hero-text">
{post.data.heroText}
</div>
<h4
class="title text-xl">
{post.data.title}

View file

@ -33,7 +33,7 @@ const imageFiles = (await Astro.glob('../assets/cat-pics/*'));
<Image
src={img.default}
width="600"
alt="Photo of a pizza"
alt="Photo of a grey cat with yellow eyes"
class="meow-image"
/>
</a>
@ -74,6 +74,7 @@ const imageFiles = (await Astro.glob('../assets/cat-pics/*'));
border-radius: 30px;
grid-row: 1 / -1;
grid-column: 1;
animation: float-rev 1s ease-in-out;
}
.meow-image:hover {
box-shadow: 0px 10px 60px -10px;
@ -83,10 +84,22 @@ const imageFiles = (await Astro.glob('../assets/cat-pics/*'));
}
@keyframes float {
0% {
box-shadow: 0px 10px 60px -10px rgba(0,0,0,0);
transform: translatey(0px);
}
100% {
box-shadow: 0px 10px 60px -10px rgba(0,0,0,1);
transform: translatey(-10px);
}
}
@keyframes float-rev {
0% {
box-shadow: 0px 10px 60px -10px rgba(0,0,0,1);
transform: translatey(-10px);
}
100% {
box-shadow: 0px 10px 60px -10px rgba(0,0,0,0);
transform: translatey(0px);
}
}
</style>

View file

@ -6,6 +6,8 @@ import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
import { getCollection } from 'astro:content';
import FormattedDate from '../../components/FormattedDate.astro';
import "../../styles/post-listing.css"
const posts = (await getCollection('unix')).sort(
(a, b) => b.data.updateDate.valueOf() - a.data.updateDate.valueOf()
);
@ -15,51 +17,10 @@ const posts = (await getCollection('unix')).sort(
<html lang="en">
<head>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
<style>
main {
width: 960px;
margin: auto;
}
ul {
display: flex;
flex-wrap: wrap;
gap: 2rem;
list-style-type: none;
margin: 0;
padding: 0;
}
ul li {
width: calc(50% - 1rem);
}
img {
height: 232px;
width: 464px;
object-fit: contain;
}
a.highlight-this {
color: var(--accent-color);
}
@media (max-width: 720px) {
ul {
gap: 0.5em;
}
ul li {
width: 100%;
text-align: center;
}
ul li:first-child {
margin-bottom: 0;
}
ul li:first-child .title {
font-size: 1.563em;
}
}
</style>
</head>
<body>
<Header />
<main>
<main class="post-listing">
<section>
<h1
class="text-center mt-8 mb-4 text-6xl"

View file

@ -0,0 +1,45 @@
/*
* This stylesheet is meant for the blog and unix notes listing pages. This is
* where a collection of posts are shown all at once.
*
* The parent <main> must have a class called ".post-listing"
*
*/
main.post-listing {
width: 960px;
margin: auto;
}
main.post-listing ul {
display: flex;
flex-wrap: wrap;
gap: 2rem;
list-style-type: none;
margin: 0;
padding: 0;
}
main.post-listing ul li {
width: calc(50% - 1rem);
}
main.post-listing img {
height: 232px;
width: 464px;
object-fit: contain;
}
main.post-listing img:hover {
filter: drop-shadow(0 0 6px rgba(0,0,0,0.3));
}
@media (max-width: 720px) {
main.post-listing ul {
gap: 0.5em;
}
main.post-listing ul li {
width: 100%;
text-align: center;
}
main.post-listing ul li:first-child {
margin-bottom: 0;
}
main.post-listing ul li:first-child .title {
font-size: 1.563em;
}
}