blob: 3d6662453d99bab7abd7764740a2e9224ff5f3b3 [file] [log] [blame]
Samuel Shuert86826b82024-04-27 16:14:20 -04001---
2import BaseHead from '../components/BaseHead.astro';
Samuel Shuert86826b82024-04-27 16:14:20 -04003import Footer from '../components/Footer.astro';
4import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
Samuel Shuert39632832024-04-29 20:54:19 -04005import { getCollection } from 'astro:content';
6import FormattedDate from '../components/FormattedDate.astro';
7
Samuel Shuert21af95a2024-04-30 17:49:11 -04008
9const posts = await getCollection('post')
10
11const pinnedPosts = posts.filter(p => p.data.pinned);
12const otherPosts = posts.filter(p => !(p.data.pinned || false))
13
Samuel Shuert86826b82024-04-27 16:14:20 -040014---
15
16<!doctype html>
17<html lang="en">
18 <head>
19 <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
20 </head>
Samuel Shuert21af95a2024-04-30 17:49:11 -040021 <body class="bg-mantle min-h-screen flex flex-col items-center">
22 <div class="flex justify-center w-full flex-col gap-2 md:min-w-[768px] px-4 md:max-w-screen-lg">
Samuel Shuert39632832024-04-29 20:54:19 -040023 <nav class="bg-mantle flex justify-center py-2 h-12">
24 <div class="flex flex-col items-center group">
25 <a href="/" class="text-text cursor-pointer hover:bg-surface0 rounded px-4 transition-colors">
26 Home
27 </a>
28 <div class="bg-text h-[2px] w-8 -mt-1 rounded-full group-hover:w-10 transition-all" />
29 </div>
30 </nav>
Samuel Shuert21af95a2024-04-30 17:49:11 -040031 <main class="w-full bg-mantle mt-6 min-h-[84vh]">
32 <section id="posts">
33 <div class="flex flex-wrap gap-4 justify-center mb-10">
Samuel Shuert39632832024-04-29 20:54:19 -040034 {
Samuel Shuert21af95a2024-04-30 17:49:11 -040035 pinnedPosts.length > 0 ? pinnedPosts.map((post) => (
36 <a href={`/post/${post.slug}/`} class="
37 h-32 text-base bg-base p-4 rounded-2xl flex flex-col flex-grow border border-blue
38 hover:bg-surface0 hover:-translate-y-2 transition-all">
39 <h4 class="text-text w-full text-ellipsis">{post.data.title}</h4>
40 <div class="text-subtext0 flex">
41 <p title="Pinned">📌&ThinSpace;</p>
42 <FormattedDate date={post.data.pubDate} />
43 </div>
44 </a>
45 )) : null
46 }
47 </div>
48 <div class="flex flex-wrap gap-4 justify-center">
49 {
50 otherPosts.length > 0 ? otherPosts.map((post, idx) => (
51 <a href={`/post/${post.slug}/`} class="
52 h-32 text-base bg-base p-4 rounded-2xl flex flex-col flex-grow
53 first:text-center first:text-xl first:border-yellow first:border first:box-border
54 first:max-md:text-left first:max-md:w-full
Samuel Shuert39632832024-04-29 20:54:19 -040055 hover:bg-surface0 hover:-translate-y-2 transition-all
56 max-md:w-full">
Samuel Shuert21af95a2024-04-30 17:49:11 -040057 <h4 class="text-text w-full text-ellipsis">{post.data.title}</h4>
58 <div class="text-subtext0 flex">
59 { idx === 0 ? <p title="Latest">✨&ThinSpace;</p> : null }
Samuel Shuert39632832024-04-29 20:54:19 -040060 <FormattedDate date={post.data.pubDate} />
Samuel Shuert21af95a2024-04-30 17:49:11 -040061 </div>
Samuel Shuert39632832024-04-29 20:54:19 -040062 </a>
Samuel Shuert21af95a2024-04-30 17:49:11 -040063 )) : null
64 }
65 </div>
66 <div class="flex justify-center h-40">
67 {
68 posts.length === 0 ?
69 <div class="border border-dashed border-surface0 rounded-xl flex justify-center items-center w-1/2">
70 No Posts Yet
71 </div> :
72 null
Samuel Shuert39632832024-04-29 20:54:19 -040073 }
74 </div>
75 </section>
76 </main>
77 </div>
Samuel Shuert86826b82024-04-27 16:14:20 -040078 <Footer />
79 </body>
80</html>