diff --git a/src/components/PostGrid.astro b/src/components/PostGrid.astro new file mode 100644 index 0000000..99277f7 --- /dev/null +++ b/src/components/PostGrid.astro @@ -0,0 +1,27 @@ +--- +import type { Post } from "../types/global"; +import PostPreviewSmall from "./PostPreviewSmall.astro"; + +interface Props { + posts: Array; +} + +const { posts } = Astro.props; +--- + +
+ { + posts.map((post_file: any) => ( + + )) + } +
+ + diff --git a/src/pages/index.astro b/src/pages/index.astro index c650ad0..03bdc1a 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,14 +1,14 @@ --- import Main from "../layouts/Main.astro"; -import PostPreviewSmall from "../components/PostPreviewSmall.astro"; import PostPreviewLarge from "../components/PostPreviewLarge.astro"; +import PostGrid from "../components/PostGrid.astro"; const allPosts: Array = Object.values( import.meta.glob("./posts/*.md", { eager: true }) ); +const posts = allPosts.slice(0, allPosts.length - 1) const mostRecentPost = allPosts.at(allPosts.length - 1); -console.log(mostRecentPost) ---
@@ -16,22 +16,5 @@ console.log(mostRecentPost) url={mostRecentPost.url} post={mostRecentPost.frontmatter} /> -
- { - allPosts - .slice(0, allPosts.length - 1) - .map((post_file: any) => ( - - )) - } -
+
- -