This commit is contained in:
Michael Zhang 2024-04-02 10:01:06 -05:00
parent 4dafc1b3e8
commit 4768a49fce
4 changed files with 16 additions and 4 deletions

View file

@ -5,7 +5,7 @@ packages:
- npm
- rsync
environment:
site: mzhang.srht.site
site: mzhang.io
secrets:
- 0b26b413-7901-41c3-a4e2-3c752228ffcb
sources:

View file

@ -5,13 +5,14 @@ import { sortBy } from "lodash-es";
import TagList from "./TagList.astro";
interface Props {
className: string;
basePath: string;
drafts?: "exclude" | "include" | "only";
filteredPosts?: Post[];
}
type Post = CollectionEntry<"posts">;
const { basePath, drafts: includeDrafts, filteredPosts } = Astro.props;
const { className, basePath, drafts: includeDrafts, filteredPosts } = Astro.props;
type FilterFn = (_: Post) => boolean;
@ -40,7 +41,7 @@ else allPosts = await getCollection("posts", filter);
const sortedPosts = sortBy(allPosts, (post) => -post.data.date);
---
<table class="postListing">
<table class={`postListing ${className}`}>
{
sortedPosts.map((post) => {
return (

View file

@ -2,6 +2,7 @@
import PostList from "../components/PostList.astro";
import BaseLayout from "../layouts/BaseLayout.astro";
import { join } from "path";
import "../styles/home.scss";
const currentUrl = Astro.url;
---
@ -9,5 +10,5 @@ const currentUrl = Astro.url;
<BaseLayout>
<h2>Blog</h2>
<PostList basePath={join(currentUrl.pathname, "posts")} />
<PostList className="home" basePath={join(currentUrl.pathname, "posts")} />
</BaseLayout>

10
src/styles/home.scss Normal file
View file

@ -0,0 +1,10 @@
.home.postListing {
.tags {
gap: 4px;
.tag {
background-color: inherit;
padding: 0;
}
}
}