on master help sign in
Merge branch 'urbit.org2' of github.com:urbit/urbit.org into urbit.org2
commitc15647c13eae34150fec548714e972f21907d75a authorMatilde Park <matilde@tlon.io> dateWed 16 Jun 2021, 19:34 (5 years ago) parent9befea98aef7a8
12 files changed+331−60
.gitignore+3 .nova/Configuration.json+3 README.md+4 components/PostPreview.js+1−1 pages/blog.js+57−49 pages/docs.js+1−1 pages/events.js+107 pages/events/[slug].js+146 pages/index.js+1−3 public/favicon.ico public/vercel.svg−4 styles/globals.css+8−2
.gitignore+3
@@ -32,3 +32,6 @@ yarn-error.log*
3232
3333# vercel
3434.vercel
35+
36+# editors
37+.nova
.nova/Configuration.jsonnew file+3
@@ -0,0 +1,3 @@
1+{
2+ "workspace.name": "urbit.org"
3+}
README.md+4
@@ -2,6 +2,10 @@ The website for Urbit.
22
33## Getting Started
44
5+```bash
6+npm install
7+```
8+
59Run the development server:
610
711```bash
components/PostPreview.js+1−1
@@ -7,7 +7,7 @@ export default function PostPreview(props) {
77 <div className={`cursor-pointer ${props.className}`}>
88 {props.title ? <h3 className="mb-2">{props.title}</h3> : null}
99
10− <Link href={`/blog/ ${props.post.slug}`} key={`post-${props.post.slug}`}>
10+ <Link href={`/blog/${props.post.slug}`} key={`post-${props.post.slug}`}>
1111 <div>
1212 <BackgroundImage
1313 className="w-full h-80 rounded-lg"
pages/blog.js+57−49
@@ -1,16 +1,14 @@
1−import Head from 'next/head'
2−import Link from 'next/link'
3−import { useState } from 'react';
4−import Container from '../components/Container'
5−import Footer from '../components/Footer'
6−import Header from '../components/Header'
7−import SingleColumn from '../components/SingleColumn'
8−import BackgroundImage from '../components/BackgroundImage'
9−import { getAllPosts, formatDate } from '../lib/lib'
1+import Head from "next/head";
2+import Link from "next/link";
3+import { useState } from "react";
4+import Container from "../components/Container";
5+import Footer from "../components/Footer";
6+import Header from "../components/Header";
7+import SingleColumn from "../components/SingleColumn";
8+import BackgroundImage from "../components/BackgroundImage";
9+import { getAllPosts, formatDate } from "../lib/lib";
1010
11−
12−export default function BlogPost({ posts }) {
13−
11+export default function Blog({ posts }) {
1412 return (
1513 <Container>
1614 <SingleColumn>
@@ -18,61 +16,71 @@ export default function BlogPost({ posts }) {
1816 <section className="layout-wide pt-48">
1917 <div className="measure">
2018 <h2 className="pb-16">Urbit Blog</h2>
21− <p className="pb-6">Stories from the broader Urbit community, the Urbit Foundation, and the many people contributing to Urbit.</p>
22− <p>Subscribe to the Urbit Newsletter for regular updates, including new blog posts and events.</p>
19+ <p className="pb-6">
20+ Stories from the broader Urbit community, the Urbit Foundation,
21+ and the many people contributing to Urbit.
22+ </p>
23+ <p>
24+ Subscribe to the Urbit Newsletter for regular updates, including
25+ new blog posts and events.
26+ </p>
2327 </div>
2428 </section>
2529 <section className="layout-wide pt-24">
26− {
27− posts.map((post) => {
28− return (
30+ {posts.map((post) => {
31+ return (
32+ <div key={post.slug} className="mb-24 cursor-pointer">
2933 <Link href={`/blog/${post.slug}`}>
30− <div key={post.slug} className='pb-24 cursor-pointer'>
34+ <div>
3135 {
3236 // Not all blog posts have images
33− post.extra.image
34− ? <BackgroundImage src={post.extra.image} style={{ height:"720px" }} className="w-full rounded-lg" />
35− : null
37+ post.extra.image ? (
38+ <BackgroundImage
39+ src={post.extra.image}
40+ style={{ height: "720px" }}
41+ className="w-full rounded-lg"
42+ />
43+ ) : null
3644 }
37− <h2 className='mt-4'>{post.title}</h2>
45+ <h2 className="mt-4">{post.title}</h2>
3846 <div className="flex items-baseline">
39− {
40− post.extra.author ? <div className='type-ui text-gray mt-4'>{post.extra.author}</div> : null
41− }
42− {
43− post.extra.author && post.extra.ship ? <div className="mx-1 text-gray">•</div> : null
44− }
45− {
46− post.extra.ship ? <div className='type-ui text-gray font-mono'>{post.extra.ship}</div> : null
47− }
47+ {post.extra.author ? (
48+ <div className="type-ui text-gray mt-4">
49+ {post.extra.author}
50+ </div>
51+ ) : null}
52+ {post.extra.author && post.extra.ship ? (
53+ <div className="mx-1 text-gray">•</div>
54+ ) : null}
55+ {post.extra.ship ? (
56+ <div className="type-ui text-gray font-mono">
57+ {post.extra.ship}
58+ </div>
59+ ) : null}
60+ </div>
61+
62+ <div className="type-ui text-gray mt-2">
63+ {formatDate(new Date(post.date))}
4864 </div>
49−
50− <div className='type-ui text-gray mt-2'>{formatDate(new Date(post.date))}</div>
5165 </div>
5266 </Link>
53− )
54− })
55− }
67+ </div>
68+ );
69+ })}
5670 </section>
57−
5871 </SingleColumn>
59− <Footer/>
72+ <Footer />
6073 </Container>
61− )
74+ );
6275}
6376
6477export async function getStaticProps() {
65− const posts = getAllPosts([
66− 'title',
67− 'slug',
68− 'date',
69− 'description',
70− 'extra',
71− ], 'blog')
78+ const posts = getAllPosts(
79+ ["title", "slug", "date", "description", "extra"],
80+ "blog"
81+ );
7282
7383 return {
7484 props: { posts },
75− }
85+ };
7686}
77−
78−
pages/docs.js+1−1
@@ -7,7 +7,7 @@ import Header from "../components/Header";
77import SingleColumn from "../components/SingleColumn";
88import BackgroundImage from "../components/BackgroundImage";
99import Lorem from "../components/Lorem";
10−import { getAllPosts, formatDate } from "../lib/lib";
10+import { getDocs, formatDate } from "../lib/lib";
1111
1212function Sidebar(props) {
1313 return (
pages/events.jsnew file+107
@@ -0,0 +1,107 @@
1+import Head from "next/head";
2+import Link from "next/link";
3+import { useState } from "react";
4+import Container from "../components/Container";
5+import Footer from "../components/Footer";
6+import Header from "../components/Header";
7+import SingleColumn from "../components/SingleColumn";
8+import BackgroundImage from "../components/BackgroundImage";
9+import { getAllPosts, formatDate } from "../lib/lib";
10+
11+function EventCard(props) {
12+ return (
13+ <div key={props.event.slug} className="mb-24 cursor-pointer">
14+ <Link href={`/events/${props.event.slug}`}>
15+ <div>
16+ {
17+ // Not all event posts have images
18+ props.event.extra.image ? (
19+ <BackgroundImage
20+ src={props.event.extra.image}
21+ style={{ height: "720px" }}
22+ className="w-full rounded-lg"
23+ />
24+ ) : (
25+ <div
26+ className="w-full rounded-lg bg-wall"
27+ style={{ height: "720px" }}
28+ ></div>
29+ )
30+ }
31+ <h2 className="mt-4">{props.event.title}</h2>
32+ <div className="flex items-baseline">
33+ {props.event.extra.author ? (
34+ <div className="type-ui text-gray mt-4">
35+ {props.event.extra.author}
36+ </div>
37+ ) : null}
38+ {props.event.extra.author && post.extra.ship ? (
39+ <div className="mx-1 text-gray">•</div>
40+ ) : null}
41+ {props.event.extra.ship ? (
42+ <div className="type-ui text-gray font-mono">
43+ {props.event.extra.ship}
44+ </div>
45+ ) : null}
46+ </div>
47+
48+ <div className="type-ui text-gray mt-2">
49+ {formatDate(new Date(props.event.date))}
50+ </div>
51+ </div>
52+ </Link>
53+ </div>
54+ );
55+}
56+
57+export default function Events({ pastEvents, currentEvents }) {
58+ return (
59+ <Container>
60+ <SingleColumn>
61+ <Header />
62+ <section className="layout-wide pt-48">
63+ <div className="measure">
64+ <h2 className="pb-16">Urbit Events</h2>
65+ <p className="pb-6">
66+ Events of all kinds: In-person, Remote, and Recorded.
67+ </p>
68+ <p>
69+ Subscribe to the Urbit Newsletter for regular updates, including
70+ new blog posts and events.
71+ </p>
72+ </div>
73+ </section>
74+ <section className="layout-wide pt-24">
75+ <div className="mb-8 table">
76+ <span className="bg-green text-white badge-lg">Coming Soon</span>
77+ </div>
78+ {currentEvents.map((post) => {
79+ return <EventCard event={post} />;
80+ })}
81+ </section>
82+
83+ <section className="layout-wide pt-24">
84+ <div className="mb-8 table">
85+ <span className="bg-wall text-gray badge-lg">Past Events</span>
86+ </div>
87+ {pastEvents.map((post) => {
88+ return <EventCard event={post} />;
89+ })}
90+ </section>
91+ </SingleColumn>
92+ <Footer />
93+ </Container>
94+ );
95+}
96+
97+export async function getStaticProps() {
98+ const posts = getAllPosts(["title", "slug", "date", "extra"], "events");
99+
100+ // NB Gavin: This logic can change based on how we want to separate past vs current events
101+ const pastEvents = posts.filter((post) => !post.extra.pinned);
102+ const currentEvents = posts.filter((post) => post.extra.pinned);
103+
104+ return {
105+ props: { pastEvents, currentEvents },
106+ };
107+}
pages/events/[slug].jsnew file+146
@@ -0,0 +1,146 @@
1+import { useRouter } from "next/router";
2+import {
3+ getPostBySlug,
4+ getAllPosts,
5+ getNextPost,
6+ getPreviousPost,
7+ formatDate,
8+} from "../../lib/lib";
9+import Head from "next/head";
10+import Link from "next/link";
11+import ErrorPage from "../404";
12+import Container from "../../components/Container";
13+import Markdown from "../../components/Markdown";
14+import Header from "../../components/Header";
15+import Footer from "../../components/Footer";
16+import BackgroundImage from "../../components/BackgroundImage";
17+import SingleColumn from "../../components/SingleColumn";
18+import NewsletterSignup from "../../components/NewletterSignup";
19+import PostPreview from "../../components/PostPreview";
20+import { name, contact } from "../../lib/constants";
21+
22+export default function Event({ post, nextPost, previousPost }) {
23+ const router = useRouter();
24+ if (!router.isFallback && !post?.slug) {
25+ return <ErrorPage />;
26+ }
27+
28+ return (
29+ <Container>
30+ <SingleColumn>
31+ <Header />
32+ <section className="flex flex-col layout-wide pt-24">
33+ <h1>{post.title}</h1>
34+ {post.extra.author ? (
35+ <div className="type-ui text-gray mt-4">{post.extra.author}</div>
36+ ) : null}
37+ {post.extra.ship ? (
38+ <div className="type-ui text-gray font-mono">{post.extra.ship}</div>
39+ ) : null}
40+ <div className="type-ui text-gray mt-16">
41+ {formatDate(new Date(post.date))}
42+ </div>
43+ </section>
44+ <article className="flex justify-center pt-12">
45+ <Markdown post={post} />
46+ </article>
47+ <section className="layout-narrow pt-24">
48+ <div className="measure">
49+ <h4 className="pb-6">
50+ If you’d like to follow our progress, we send monthly updates via
51+ email:
52+ </h4>
53+ </div>
54+ <NewsletterSignup color="black" />
55+ <h4 className="mt-12 text-gray">
56+ Follow us on{" "}
57+ <a className="text-black" href={contact.twitter}>
58+ Twitter
59+ </a>
60+ </h4>
61+ <h4 className="mt-6 text-gray">
62+ Explore code on{" "}
63+ <a className="text-black" href={contact.github}>
64+ Github
65+ </a>
66+ </h4>
67+ <h4 className="mt-6 text-gray">
68+ Ask questions in our{" "}
69+ <a className="text-black" href={contact.discord}>
70+ Discord
71+ </a>
72+ </h4>
73+ <h4 className="mt-6 text-gray">
74+ Boot Urbit and join{" "}
75+ <code className="bg-wall p-2 rounded-lg">
76+ {contact.urbitCommunity}
77+ </code>
78+ </h4>
79+ </section>
80+ <section className="layout-wide pt-24 flex">
81+ {previousPost === null ? (
82+ <div className={"w-1/2 mr-4"} />
83+ ) : (
84+ <PostPreview
85+ title="Previous Post"
86+ post={previousPost}
87+ className="mr-4 w-1/2"
88+ />
89+ )}
90+ {nextPost === null ? (
91+ <div className={"w-1/2 ml-4"} />
92+ ) : (
93+ <PostPreview
94+ title="Next Post"
95+ post={nextPost}
96+ className="ml-4 w-1/2"
97+ />
98+ )}
99+ </section>
100+ </SingleColumn>
101+ <Footer />
102+ </Container>
103+ );
104+}
105+
106+//
107+export async function getStaticProps({ params }) {
108+ const nextPost =
109+ getNextPost(
110+ params.slug,
111+ ["title", "slug", "date", "description", "extra"],
112+ "events"
113+ ) || null;
114+
115+ const previousPost =
116+ getPreviousPost(
117+ params.slug,
118+ ["title", "slug", "date", "description", "extra"],
119+ "events"
120+ ) || null;
121+
122+ const post = getPostBySlug(
123+ params.slug,
124+ ["title", "slug", "date", "description", "content", "extra"],
125+ "events"
126+ );
127+
128+ return {
129+ props: { post, nextPost, previousPost },
130+ };
131+}
132+
133+export async function getStaticPaths() {
134+ const posts = getAllPosts(["slug", "date"], "events");
135+
136+ return {
137+ paths: posts.map((post) => {
138+ return {
139+ params: {
140+ slug: post.slug,
141+ },
142+ };
143+ }),
144+ fallback: false,
145+ };
146+}
pages/index.js+1−3
@@ -50,9 +50,7 @@ export default function Home({ posts, events }) {
5050 <section className="layout-narrow pt-48">
5151 <div className="flex items-center measure pb-12">
5252 <h2 className="m-0 p-0 mr-4">Urbit Grants</h2>
53− <button className="flex bg-green text-white type-ui px-4 items-center justify-center h-12 rounded-full">
54− 32 Open
55− </button>
53+ <button className="bg-green text-white badge-lg">32 Open</button>
5654 </div>
5755 <div className="flex w-full items-center bg-washedGreen px-8 py-8 rounded-xl">
5856 <div className="flex items-center flex-col p-4 w-full">
public/favicon.icodeleted

Binary file not shown.

public/vercel.svgdeleted−4
@@ -1,4 +0,0 @@
1−<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
2− xmlns="http://www.w3.org/2000/svg">
3− <path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
4−</svg>
styles/globals.css+8−2
@@ -67,14 +67,20 @@ code .type-code {
6767 @apply bg-wall p-4 font-mono;
6868}
6969
70+button {
71+ border: none;
72+}
73+
7074.button-sm {
7175 @apply flex px-4 py-1 rounded type-ui;
72− border: none;
7376}
7477
7578.button-lg {
7679 @apply flex px-6 py-2 rounded-lg h-16 flex-center type-ui;
77− border: none;
80+}
81+
82+.badge-lg {
83+ @apply flex type-ui px-4 items-center justify-center h-12 rounded-full;
7884}
7985
8086.tab-button-lg {