on 514b5fc help sign in
urbit.org/pages/updates.js
80 lines 2.6 kB history raw
1import Head from "next/head";
2import Meta from "../components/Meta";
3import Link from "next/link";
4import Container from "../components/Container";
5import Footer from "../components/Footer";
6import Header from "../components/Header";
7import SingleColumn from "../components/SingleColumn";
8import BackgroundImage from "../components/BackgroundImage";
9import Section from "../components/Section";
10import { getAllPosts, formatDate, generateDisplayDate } from "../lib/lib";
11import { contact } from "../lib/constants";
13export default function Updates({ posts, search }) {
14 const post = {
15 title: "Updates",
16 description: "Missives from the Urbit Foundation.",
17 };
18 return (
19 <Container>
20 <Head>
21 <title>Updates • urbit.org</title>
22 {Meta(post)}
23 </Head>
24 <SingleColumn>
25 <Header search={search} />
26 <Section narrow>
27 <div className="measure">
28 <h1 className="pb-16">Updates</h1>
29 <p className="pb-6">Missives from the Urbit Foundation.</p>
30 </div>
31 </Section>
32 <Section narrow>
33 {posts.map((post) => {
34 const date = generateDisplayDate(post.date);
35 return (
36 <div key={post.slug} className="mb-24 cursor-pointer">
37 <Link href={`/updates/${post.slug}`}>
38 <div>
39 <h3 className="mt-4">{post.title}</h3>
40 <div className="flex items-baseline">
41 {post?.extra.author ? (
42 <div className="type-ui text-wall-500 mt-4">
43 {post?.extra.author}
44 </div>
45 ) : null}
46 {post?.extra.author && post?.extra.ship ? (
47 <div className="mx-1 text-wall-500">•</div>
48 ) : null}
49 {post?.extra.ship ? (
50 <div className="type-ui text-wall-500 font-mono">
51 {post.extra.ship}
52 </div>
53 ) : null}
54 </div>
56 <div className="type-ui text-wall-500 mt-2">
57 {formatDate(date)}
58 </div>
59 </div>
60 </Link>
61 </div>
62 );
63 })}
64 </Section>
65 </SingleColumn>
66 <Footer />
67 </Container>
68 );
71export async function getStaticProps() {
72 const posts = getAllPosts(
73 ["title", "slug", "date", "description", "extra"],
74 "updates"
75 );
77 return {
78 props: { posts },
79 };