1import Link from "next/link";
2import { useRouter } from "next/router";
3import { useState } from "react";
4import classnames from "classnames";
5import path from "path";
6import MenuTray from "../components/MenuTray";
7import Section from "../components/Section";
8import { capitalize } from "../lib/lib";
10function ActiveLink({ children, href, className, currentPath }) {
11 const firstCrumb = currentPath.split("/")[1];
13 const activeClassName = classnames({
14 "text-black": "/" + firstCrumb === href,
15 "text-gray": "/" + firstCrumb !== href,
20 <a className={`${className} ${activeClassName}`}>{children}</a>
25export default function Header(props) {
26 const [isOpen, setTray] = useState(false);
28 const currentPath = useRouter().asPath;
30 const routeDepth = currentPath.split("/").length;
32 const firstCrumb = currentPath.split("/")[1];
35 <header className="w-full px-4 md:px-8 md:w-10/12 flex flex-row justify-between items-center pt-8 md:pt-10 lg:pt-12 pb-10 md:pb-12 lg:pb-24">
38 <a className="type-ui">Urbit</a>
41 <Link href={`/${firstCrumb}`}>
42 <a className="inline md:hidden type-ui text-gray ml-2">
43 {capitalize(firstCrumb)}
49 // Large screen header
51 <nav className="items-center hidden md:flex">
53 currentPath={currentPath}
54 className="mr-5 type-ui"
60 currentPath={currentPath}
61 className="mr-5 type-ui"
67 currentPath={currentPath}
68 className="mr-5 type-ui"
74 currentPath={currentPath}
75 className="mr-5 text-green type-ui button-text"
76 href="/getting-started"
83 props.search.toggleSearch(e);
85 className="button-sm bg-wall text-gray"
87 Search<div className="ml-4 text-lightGray">⌘K</div>
92 // Small screen header
94 <MenuTray isOpen={isOpen} setTray={setTray}>
96 <a className="type-ui mb-12">Urbit</a>
99 currentPath={currentPath}
100 className="mr-5 mb-4 type-h3"
106 currentPath={currentPath}
107 className="mr-5 mb-4 type-h3"
113 currentPath={currentPath}
114 className="mr-5 mb-4 type-h3"
120 currentPath={currentPath}
121 className="mr-5 mb-4 type-h3"
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