2024-12-23 21:18:55 +00:00
|
|
|
---
|
|
|
|
import Layout from "@layouts/Layout.astro";
|
|
|
|
import { HOME } from "@consts";
|
|
|
|
import { getCollection } from "astro:content";
|
2024-12-26 22:45:38 +00:00
|
|
|
import ShowcaseProject from "@components/ShowcaseProject.astro";
|
|
|
|
import ShowcasePost from "@components/ShowcasePost.astro";
|
2025-01-05 18:49:48 +00:00
|
|
|
import Hero from "@components/Hero.astro";
|
2024-12-23 21:18:55 +00:00
|
|
|
|
2025-01-05 20:25:30 +00:00
|
|
|
const allPosts = await getCollection("posts");
|
|
|
|
|
|
|
|
const posts = allPosts
|
2024-12-23 21:18:55 +00:00
|
|
|
.filter((post) => !post.data.draft)
|
|
|
|
.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf())
|
|
|
|
.slice(0, HOME.HOMESETTINGS?.NUM_POSTS_ON_HOMEPAGE);
|
|
|
|
|
2025-01-05 20:25:30 +00:00
|
|
|
const allProjects = await getCollection("projects");
|
|
|
|
|
|
|
|
const projects = allProjects
|
2024-12-23 21:18:55 +00:00
|
|
|
.filter((project) => !project.data.draft && project.data.featured)
|
|
|
|
.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf())
|
|
|
|
.slice(0, HOME.HOMESETTINGS?.NUM_PROJECTS_ON_HOMEPAGE);
|
|
|
|
---
|
|
|
|
|
|
|
|
<Layout title={HOME.TITLE} description={HOME.DESCRIPTION}>
|
2025-01-05 18:49:48 +00:00
|
|
|
<Hero />
|
|
|
|
<section class="mb-32" aria-labelledby="featured-projects">
|
|
|
|
<div class="group flex w-fit flex-row items-center justify-between gap-6">
|
2024-12-23 21:18:55 +00:00
|
|
|
<a href="/projects">
|
|
|
|
<h2
|
2025-01-05 18:49:48 +00:00
|
|
|
class="animate-reveal break-words text-4xl font-semibold capitalize opacity-0 transition-colors duration-500 group-hover:text-tertiary"
|
2024-12-23 21:18:55 +00:00
|
|
|
id="featured-projects"
|
|
|
|
>
|
|
|
|
Featured projects
|
|
|
|
</h2>
|
|
|
|
</a>
|
|
|
|
</div>
|
2024-12-26 22:45:38 +00:00
|
|
|
<ol
|
2024-12-26 15:02:43 +00:00
|
|
|
class="mt-16 grid animate-reveal grid-cols-1 gap-6 opacity-0 [animation-delay:0.1s] md:grid-cols-3 md:[&>*:nth-child(4n+2)]:col-span-2 md:[&>*:nth-child(4n+3)]:col-span-2 md:[&>*:only-child]:col-span-3"
|
2024-12-23 21:18:55 +00:00
|
|
|
>
|
2024-12-26 22:45:38 +00:00
|
|
|
{projects.map((project) => <ShowcaseProject collection={project} />)}
|
|
|
|
</ol>
|
2025-01-05 18:49:48 +00:00
|
|
|
{
|
2025-01-05 20:25:30 +00:00
|
|
|
allProjects.length > HOME.HOMESETTINGS!.NUM_PROJECTS_ON_HOMEPAGE ? (
|
2025-01-05 18:49:48 +00:00
|
|
|
<a href="/projects">
|
|
|
|
<div class="mt-8 flex animate-reveal flex-row items-center gap-1 justify-self-center rounded-full bg-tertiary px-3 py-2 font-medium capitalize text-primary opacity-0 transition-colors duration-300 [animation-delay:0.1s] hover:bg-accent">
|
|
|
|
View all
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
) : null
|
|
|
|
}
|
2024-12-23 21:18:55 +00:00
|
|
|
</section>
|
|
|
|
<section aria-labelledby="recent-posts">
|
2025-01-05 18:49:48 +00:00
|
|
|
<div class="group flex w-fit flex-row items-center justify-between gap-6">
|
2024-12-23 21:18:55 +00:00
|
|
|
<a href="/posts">
|
|
|
|
<h2
|
2025-01-05 18:49:48 +00:00
|
|
|
class="animate-reveal break-words text-4xl font-semibold capitalize opacity-0 transition-colors duration-500 [animation-delay:0.2s] group-hover:text-tertiary"
|
|
|
|
id="featured-projects"
|
2024-12-23 21:18:55 +00:00
|
|
|
>
|
|
|
|
Recent posts
|
|
|
|
</h2>
|
|
|
|
</a>
|
|
|
|
</div>
|
2024-12-26 22:45:38 +00:00
|
|
|
<ol
|
|
|
|
class="mt-16 grid animate-reveal grid-cols-1 gap-6 opacity-0 [animation-delay:0.3s]"
|
2024-12-23 21:18:55 +00:00
|
|
|
>
|
2024-12-26 22:45:38 +00:00
|
|
|
{posts.map((post) => <ShowcasePost collection={post} />)}
|
|
|
|
</ol>
|
2025-01-05 18:49:48 +00:00
|
|
|
{
|
2025-01-05 20:25:30 +00:00
|
|
|
allPosts.length > HOME.HOMESETTINGS!.NUM_POSTS_ON_HOMEPAGE ? (
|
2025-01-05 18:49:48 +00:00
|
|
|
<a href="/posts">
|
|
|
|
{" "}
|
|
|
|
<div class="mt-8 flex animate-reveal flex-row items-center gap-1 justify-self-center rounded-full bg-tertiary px-3 py-2 font-medium capitalize text-primary opacity-0 transition-colors duration-300 [animation-delay:0.1s] hover:bg-accent">
|
|
|
|
View all
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
) : null
|
|
|
|
}
|
2024-12-23 21:18:55 +00:00
|
|
|
</section>
|
|
|
|
</Layout>
|