on roller-tutorial help sign in
urbit.org/components/GrantProgramOverview.js
57 lines 1.6 kB history raw
1import { useRouter } from "next/router";
2import { formatDate } from "../lib/lib";
3import Link from "next/link";
4import Head from "next/head";
5import Meta from "../components/Meta";
6import ErrorPage from "../pages/404";
7import Container from "./Container";
8import Header from "./Header";
9import Footer from "./Footer";
10import SingleColumn from "./SingleColumn";
11import Section from "./Section";
12import { decode } from "html-entities";
13import { DateTime } from "luxon";
15export default function GrantProgramOverview({
16 post,
17 markdown,
18 search,
19 program,
20 actionLink,
21 actionText,
22}) {
23 const router = useRouter();
24 if (!router.isFallback && !post?.slug) {
25 return <ErrorPage />;
26 }
28 const title = program.charAt(0).toUpperCase() + program.slice(1);
29 return (
30 <Container>
31 <Head>
32 <title>{title} • Grants • urbit.org</title>
33 {Meta(post)}
34 </Head>
35 <SingleColumn>
36 <Header search={search} />
37 <Section narrow short>
38 <h1>{post.title}</h1>
39 <div className="type-ui text-wall-500 mt-4 md:mt-8 lg:mt-10">
40 Last Revision: {formatDate(DateTime.fromISO(post.date))}
41 </div>
42 <Link href={actionLink}>
43 <button className="button-sm bg-green-400 text-white mt-8">
44 {actionText}
45 </button>
46 </Link>
47 </Section>
48 <Section narrow short className="markdown">
49 <article
50 dangerouslySetInnerHTML={{ __html: decode(markdown) }}
51 ></article>
52 </Section>
53 </SingleColumn>
54 <Footer />
55 </Container>
56 );