import Link from "next/link"; import { useRouter } from "next/router"; import { useState, useEffect } from "react"; import classnames from "classnames"; import path from "path"; import MenuTray from "../components/MenuTray"; import Section from "../components/Section"; import { capitalize } from "../lib/lib"; function ActiveLink({ children, href, className, currentPath }) { const firstCrumb = currentPath.split("/")[1]; const activeClassName = classnames({ "text-wall-600": "/" + firstCrumb === href, "text-wall-500": "/" + firstCrumb !== href, }); return ( {children} ); } export default function Header(props) { const [isOpen, setTray] = useState(false); const [shortcut, setShortcut] = useState(""); const currentPath = useRouter().asPath; const routeDepth = currentPath.split("/").length; const firstCrumb = currentPath.split("/")[1]; const detectOS = () => { const agent = window.navigator.appVersion; if (agent.includes("Win")) { return "Ctrl+K"; } else if (agent.includes("Mac")) { return "⌘K"; } else if (agent.includes("Linux")) { return "Ctrl+K"; } }; useEffect(() => { setShortcut(detectOS()); }, []); return (
Urbit {routeDepth > 2 ? ( {capitalize(firstCrumb)} ) : null}
{ // Large screen header } { // Small screen header } Urbit Docs Blog Events Grants
); }