on master help sign in
pages: add intranav component
commit3e61015f4f9769ec00c01cde92d394d4baa50430 authorMatilde Park <matilde.park@urbit.org> dateTue 21 Jun 2022, 01:27 (4 years ago) parent332f89e
16 files changed+80−50
components/BasicPage.js+3−1 components/GrantProgramOverview.js+3−1 components/Header.js−26 package-lock.json+2−2 pages/404.js+8−2 pages/blog.js+8−2 pages/blog/[slug].js+4−1 pages/events.js+8−2 pages/events/[slug].js+3−1 pages/grants.js+8−2 pages/grants/[slug].js+3−1 pages/index.js+8−3 pages/media.js+8−2 pages/media/[slug].js+3−1 pages/updates.js+8−2 pages/updates/[slug].js+3−1
components/BasicPage.js+3−1
@@ -7,6 +7,7 @@ import {
77 SingleColumn,
88 Section,
99 Markdown,
10+ IntraNav,
1011} from "foundation-design-system";
1112import Header from "./Header";
1213import Footer from "./Footer";
@@ -24,8 +25,9 @@ export default function BasicPage({ post, markdown, search, index = false }) {
2425 <title>Urbit • {post.title}</title>
2526 {Meta(post)}
2627 </Head>
28+ <IntraNav ourSite="https://urbit.org" search={search} />
2729 <SingleColumn>
28− <Header search={search} />
30+ <Header />
2931 <Section narrow>
3032 <h1>{post.title}</h1>
3133 </Section>
components/GrantProgramOverview.js+3−1
@@ -9,6 +9,7 @@ import {
99 Section,
1010 SingleColumn,
1111 Markdown,
12+ IntraNav,
1213} from "foundation-design-system";
1314import Header from "./Header";
1415import Footer from "./Footer";
@@ -34,8 +35,9 @@ export default function GrantProgramOverview({
3435 <title>{title} • Grants • urbit.org</title>
3536 {Meta(post)}
3637 </Head>
38+ <IntraNav ourSite="https://urbit.org" search={search} />
3739 <SingleColumn>
38− <Header search={search} />
40+ <Header />
3941 <Section narrow short>
4042 <h1>{post.title}</h1>
4143 <div className="type-ui text-wall-500 mt-4 md:mt-8 lg:mt-10">
components/Header.js−26
@@ -22,7 +22,6 @@ function ActiveLink({ children, href, className, currentPath }) {
2222
2323export default function Header(props) {
2424 const [isOpen, setTray] = useState(false);
25− const [shortcut, setShortcut] = useState("");
2625
2726 const currentPath = useRouter().asPath;
2827
@@ -30,21 +29,6 @@ export default function Header(props) {
3029
3130 const firstCrumb = currentPath.split("/")[1];
3231
33− const detectOS = () => {
34− const agent = window.navigator.appVersion;
35− if (agent.includes("Win")) {
36− return "Ctrl+K";
37− } else if (agent.includes("Mac")) {
38− return "⌘K";
39− } else if (agent.includes("Linux")) {
40− return "Ctrl+K";
41− }
42− };
43−
44− useEffect(() => {
45− setShortcut(detectOS());
46− }, []);
47−
4832 return (
4933 <header className="layout px-4 md:px-8 flex justify-between items-center pt-8 md:pt-10 lg:pt-12 pb-10 md:pb-12 lg:pb-24">
5034 <div>
@@ -105,16 +89,6 @@ export default function Header(props) {
10589 >
10690 FAQ
10791 </ActiveLink>
108− <button
109− onClick={(e) => {
110− e.stopPropagation();
111− props.search.toggleSearch(e);
112− }}
113− className="bg-wall-100 text-wall-500 flex px-4 py-1 rounded-lg type-ui"
114− >
115− <div>Search</div>
116− <div className="ml-4 text-wall-400">{shortcut}</div>
117− </button>
11892 </nav>
11993
12094 {
package-lock.json+2−2
@@ -1091,7 +1091,7 @@
10911091 },
10921092 "node_modules/foundation-design-system": {
10931093 "version": "0.0.0",
1094− "resolved": "git+ssh://git@github.com/urbit/foundation-design-system.git#a31bcd08731d3b787e2739ebf740a7c6b5a278d2",
1094+ "resolved": "git+ssh://git@github.com/urbit/foundation-design-system.git#3039c76cf3840ebf903fca3216e17fc5cb29939b",
10951095 "license": "MIT",
10961096 "dependencies": {
10971097 "@markdoc/markdoc": "0.1.2",
@@ -3556,7 +3556,7 @@
35563556 "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA=="
35573557 },
35583558 "foundation-design-system": {
3559− "version": "git+ssh://git@github.com/urbit/foundation-design-system.git#a31bcd08731d3b787e2739ebf740a7c6b5a278d2",
3559+ "version": "git+ssh://git@github.com/urbit/foundation-design-system.git#3039c76cf3840ebf903fca3216e17fc5cb29939b",
35603560 "from": "foundation-design-system@github:urbit/foundation-design-system",
35613561 "requires": {
35623562 "@markdoc/markdoc": "0.1.2",
pages/404.js+8−2
@@ -1,6 +1,11 @@
11import Head from "next/head";
22import Meta from "../components/Meta";
3−import { Container, SingleColumn, Section } from "foundation-design-system";
3+import {
4+ Container,
5+ SingleColumn,
6+ Section,
7+ IntraNav,
8+} from "foundation-design-system";
49import Header from "../components/Header";
510import Footer from "../components/Footer";
611
@@ -14,8 +19,9 @@ export default function NotFound(props) {
1419 <title>404 • urbit.org</title>
1520 {Meta(post)}
1621 </Head>
22+ <IntraNav ourSite="https://urbit.org" search={props.search} />
1723 <SingleColumn>
18− <Header search={props.search} />
24+ <Header />
1925 <Section className="pt-48">
2026 <h1>404</h1>
2127 <p className="mt-12">It looks like nothing is here.</p>
pages/blog.js+8−2
@@ -1,7 +1,12 @@
11import Head from "next/head";
22import Meta from "../components/Meta";
33import Link from "next/link";
4−import { Container, SingleColumn, Section } from "foundation-design-system";
4+import {
5+ Container,
6+ SingleColumn,
7+ Section,
8+ IntraNav,
9+} from "foundation-design-system";
510import Footer from "../components/Footer";
611import Header from "../components/Header";
712import BackgroundImage from "../components/BackgroundImage";
@@ -20,8 +25,9 @@ export default function Blog({ posts, search }) {
2025 <title>Blog • urbit.org</title>
2126 {Meta(post)}
2227 </Head>
28+ <IntraNav ourSite="https://urbit.org" search={search} />
2329 <SingleColumn>
24− <Header search={search} />
30+ <Header />
2531 <Section narrow>
2632 <div className="measure">
2733 <h1 className="pb-16">Blog</h1>
pages/blog/[slug].js+4−1
@@ -1,4 +1,5 @@
11import { useRouter } from "next/router";
2+import { useState, useEffect } from "react";
23import {
34 getPostBySlug,
45 getAllPosts,
@@ -14,6 +15,7 @@ import ErrorPage from "../404";
1415import {
1516 Container,
1617 Markdown,
18+ IntraNav,
1719 SingleColumn,
1820 Section,
1921} from "foundation-design-system";
@@ -41,8 +43,9 @@ export default function Post({
4143 <title>{post.title} • Blog • urbit.org</title>
4244 {Meta(post)}
4345 </Head>
46+ <IntraNav ourSite="https://urbit.org" search={search} />
4447 <SingleColumn>
45− <Header search={search} />
48+ <Header />
4649 <Section short narrow>
4750 <h1>{post.title}</h1>
4851 <h3 className=" mt-6">{post.description}</h3>
pages/events.js+8−2
@@ -3,7 +3,12 @@ import Link from "next/link";
33import { DateTime } from "luxon";
44
55import Meta from "../components/Meta";
6−import { Container, SingleColumn, Section } from "foundation-design-system";
6+import {
7+ Container,
8+ SingleColumn,
9+ Section,
10+ IntraNav,
11+} from "foundation-design-system";
712import Footer from "../components/Footer";
813import Header from "../components/Header";
914import EventPreview from "../components/EventPreview";
@@ -53,8 +58,9 @@ export default function Events({ events, search }) {
5358 <title>Events • urbit.org</title>
5459 {Meta(post)}
5560 </Head>
61+ <IntraNav ourSite="https://urbit.org" search={search} />
5662 <SingleColumn>
57− <Header search={search} />
63+ <Header />
5864 <Section short narrow>
5965 <div className="measure">
6066 <h1 className="pb-16">Events</h1>
pages/events/[slug].js+3−1
@@ -14,6 +14,7 @@ import {
1414 Markdown,
1515 SingleColumn,
1616 Section,
17+ IntraNav,
1718} from "foundation-design-system";
1819import Header from "../../components/Header";
1920import Footer from "../../components/Footer";
@@ -50,8 +51,9 @@ export default function Event({
5051 <title>{event.title} • Events • urbit.org</title>
5152 {Meta(event)}
5253 </Head>
54+ <IntraNav ourSite="https://urbit.org" search={search} />
5355 <SingleColumn>
54− <Header search={search} />
56+ <Header />
5557 <Section narrow short>
5658 <h1>{event.title}</h1>
5759 <h3 className="mt-6">{event.description}</h3>
pages/grants.js+8−2
@@ -2,7 +2,12 @@ import Head from "next/head";
22import Meta from "../components/Meta";
33import Link from "next/link";
44import { useRouter } from "next/router";
5−import { Container, SingleColumn, Section } from "foundation-design-system";
5+import {
6+ Container,
7+ SingleColumn,
8+ Section,
9+ IntraNav,
10+} from "foundation-design-system";
611import Footer from "../components/Footer";
712import Header from "../components/Header";
813import GrantPreview from "../components/GrantPreview";
@@ -117,8 +122,9 @@ export default function Grants({ posts, categories, types, search }) {
117122 "Contribute to the Urbit project while earning address space.",
118123 })}
119124 </Head>
125+ <IntraNav ourSite="https://urbit.org" search={search} />
120126 <SingleColumn>
121− <Header search={search} />
127+ <Header />
122128 {
123129 // Heading and Introduction
124130 }
pages/grants/[slug].js+3−1
@@ -10,6 +10,7 @@ import {
1010 Markdown,
1111 SingleColumn,
1212 Section,
13+ IntraNav,
1314} from "foundation-design-system";
1415import Header from "../../components/Header";
1516import Footer from "../../components/Footer";
@@ -48,8 +49,9 @@ export default function Grant({ post, markdown, search }) {
4849 <title>{post.title} • Grants • urbit.org</title>
4950 {Meta(post)}
5051 </Head>
52+ <IntraNav ourSite="https://urbit.org" search={search} />
5153 <SingleColumn>
52− <Header search={search} />
54+ <Header />
5355 <Section narrow short>
5456 <h1>{post.title}</h1>
5557 {post.extra.assignee ? (
pages/index.js+8−3
@@ -3,7 +3,12 @@ import Link from "next/link";
33import React from "react";
44import { DateTime } from "luxon";
55
6−import { Container, Section, SingleColumn } from "foundation-design-system";
6+import {
7+ Container,
8+ Section,
9+ SingleColumn,
10+ IntraNav,
11+} from "foundation-design-system";
712import Header from "../components/Header";
813import Footer from "../components/Footer";
914import Contact from "../components/Contact";
@@ -20,9 +25,9 @@ export default function Home({ posts, events, grantNumbers, search }) {
2025 <Head>
2126 <title>urbit.org</title>
2227 </Head>
23− {/* {bannerElement} */}
28+ <IntraNav ourSite="https://urbit.org" search={search} />
2429 <SingleColumn>
25− <Header search={search} />
30+ <Header />
2631 {
2732 // Hero Statement
2833 }
pages/media.js+8−2
@@ -1,7 +1,12 @@
11import Head from "next/head";
22import Link from "next/link";
33import Meta from "../components/Meta";
4−import { Container, SingleColumn, Section } from "foundation-design-system";
4+import {
5+ Container,
6+ SingleColumn,
7+ Section,
8+ IntraNav,
9+} from "foundation-design-system";
510import Footer from "../components/Footer";
611import Header from "../components/Header";
712import { getAllPosts } from "../lib/lib";
@@ -73,8 +78,9 @@ export default function Media({ posts, search }) {
7378 <title>Media • urbit.org</title>
7479 {Meta(post)}
7580 </Head>
81+ <IntraNav ourSite="https://urbit.org" search={search} />
7682 <SingleColumn>
77− <Header search={search} />
83+ <Header />
7884 <Section narrow>
7985 <div className="measure">
8086 <h1 className="pb-16">Media</h1>
pages/media/[slug].js+3−1
@@ -14,6 +14,7 @@ import {
1414 Markdown,
1515 SingleColumn,
1616 Section,
17+ IntraNav,
1718} from "foundation-design-system";
1819import Header from "../../components/Header";
1920import Footer from "../../components/Footer";
@@ -31,8 +32,9 @@ export default function MediaPage({ post, markdown, search }) {
3132 <title>{post.title} • Media • urbit.org</title>
3233 {Meta(post)}
3334 </Head>
35+ <IntraNav ourSite="https://urbit.org" search={search} />
3436 <SingleColumn>
35− <Header search={search} />
37+ <Header />
3638 <Section narrow short>
3739 <h1>{post.title}</h1>
3840 {post.extra.author ? (
pages/updates.js+8−2
@@ -1,7 +1,12 @@
11import Head from "next/head";
22import Meta from "../components/Meta";
33import Link from "next/link";
4−import { Container, SingleColumn, Section } from "foundation-design-system";
4+import {
5+ Container,
6+ SingleColumn,
7+ Section,
8+ IntraNav,
9+} from "foundation-design-system";
510import Footer from "../components/Footer";
611import Header from "../components/Header";
712import { getAllPosts, formatDate, generateDisplayDate } from "../lib/lib";
@@ -17,8 +22,9 @@ export default function Updates({ posts, search }) {
1722 <title>Updates • urbit.org</title>
1823 {Meta(post)}
1924 </Head>
25+ <IntraNav ourSite="https://urbit.org" search={search} />
2026 <SingleColumn>
21− <Header search={search} />
27+ <Header />
2228 <Section narrow>
2329 <div className="measure">
2430 <h1 className="pb-16">Updates</h1>
pages/updates/[slug].js+3−1
@@ -15,6 +15,7 @@ import {
1515 Markdown,
1616 SingleColumn,
1717 Section,
18+ IntraNav,
1819} from "foundation-design-system";
1920import Header from "../../components/Header";
2021import Footer from "../../components/Footer";
@@ -32,8 +33,9 @@ export default function Post({ post, markdown, search }) {
3233 <title>{post.title} • Updates • urbit.org</title>
3334 {Meta(post)}
3435 </Head>
36+ <IntraNav ourSite="https://urbit.org" search={search} />
3537 <SingleColumn>
36− <Header search={search} />
38+ <Header />
3739 <Section short narrow>
3840 <h1>{post.title}</h1>
3941 {post.author ? (