/**
 * @copyright nhcarrigan
 * @license Naomi's Public License
 * @author Naomi Carrigan
 */

import { Rule } from "@/components/rule";
import { getSortedPostsData } from "@/lib/posts";

export default function Home() {
  const posts = getSortedPostsData();
  return (
    <main>
      <h1>{"Announcements"}</h1>
      <p>{"This page documents all of our organisation's announcements, in reverse chronological order."}</p>
        {posts.map((post) => {
          return <div key={post.slug}>
            <Rule />
            <h2><a className="underline" href={`/post/${post.slug}`}>{post.data.title}</a></h2>
            <p className="italic text-center">{post.data.date.toLocaleDateString("en-GB",{ year: "numeric", month: "long", day: "numeric"})}</p>
            <p>{post.data.summary}</p>
          </div>;
        })}
    </main>
  );
}
