1import Link from "next/link";
2import { useRouter } from "next/router";
3import { useState } from "react";
4import classnames from "classnames";
5import { capitalize, MenuTray } from "@urbit/foundation-design-system";
7function ActiveLink({ children, href, className, currentPath }) {
8 const firstCrumb = currentPath.split("/")[1];
10 const activeClassName = classnames({
11 "text-wall-900": "/" + firstCrumb === href,
12 "text-wall-500": "/" + firstCrumb !== href,
16 <Link href={href} passHref>
17 <a className={`${className} ${activeClassName}`}>{children}</a>
22export default function Header(props) {
23 const [isOpen, setTray] = useState(false);
25 const currentPath = useRouter().asPath;
27 const routeDepth = currentPath.split("/").length;
29 const firstCrumb = currentPath.split("/")[1];
32 <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">
34 <Link href="/" passHref>
35 <a className="font-semibold text-lg">Urbit</a>
38 <Link href={`/${firstCrumb}`} passHref>
39 <a className="inline md:hidden type-ui text-wall-500 ml-2">
40 {capitalize(firstCrumb)}
46 // Large screen header
48 <nav className="items-center hidden md:flex">
50 currentPath={currentPath}
51 className="mr-5 type-ui"
52 href="/getting-started"
58 currentPath={currentPath}
59 className="mr-5 type-ui"
66 currentPath={currentPath}
67 className="mr-5 type-ui"
74 currentPath={currentPath}
75 className="mr-5 type-ui"
82 currentPath={currentPath}
83 className="mr-5 type-ui"
90 currentPath={currentPath}
91 className="mr-5 type-ui"
99 // Small screen header
101 <MenuTray isOpen={isOpen} setTray={setTray} search={props.search}>
102 <Link href="/" passHref>
103 <a className="font-semibold mb-4">Urbit</a>
105 <Link href="https://urbit.org" passHref>
106 <a className="font-semibold mt-2">Urbit.org</a>
108 <Link href="https://operators.urbit.org" passHref>
109 <a className="mt-2">Operators</a>
111 <Link href="https://developers.urbit.org" passHref>
112 <a className="mt-2">Developers</a>
114 <Link href="https://roadmap.urbit.org" passHref>
115 <a className="mt-2 mb-4">Roadmap</a>
117 <hr className="border-wall-200" />
120 currentPath={currentPath}
121 className="mr-5 mt-4 mb-4 text-green-400"
122 href="/getting-started"
128 currentPath={currentPath}
129 className="mr-5 mb-4"
136 currentPath={currentPath}
137 className="mr-5 mb-4"
144 currentPath={currentPath}
145 className="mr-5 mb-4"
152 currentPath={currentPath}
153 className="mr-5 mb-4"
160 currentPath={currentPath}
161 className="mr-5 mb-4"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list