1import Section from "./Section";
2import { useState, useEffect, useRef } from "react";
3import { useRouter } from "next/router";
4import { TableOfContents } from "./TableOfContents";
6export default function ContentArea(props) {
7 const [shortcut, setShortcut] = useState("");
9 const detectOS = () => {
10 const agent = window.navigator.appVersion;
11 if (agent.includes("Win")) {
13 } else if (agent.includes("Mac")) {
15 } else if (agent.includes("Linux")) {
21 setShortcut(detectOS());
24 const scrollBox = useRef();
26 const router = useRouter();
29 const handleRouteChange = () => {
30 if (scrollBox.current === null) return;
31 scrollBox.current.scrollTop = 0;
34 router.events.on("routeChangeComplete", handleRouteChange);
36 // If the component is unmounted, unsubscribe
37 // from the event with the `off` method:
39 router.events.off("routeChangeStart", handleRouteChange);
44 <div className="w-full min-w-0 flex flex-col items-center">
47 className="px-4 md:px-12 lg:px-24 pb-24 pt-8 md:pt-10 lg:pt-16 flex flex-col w-full max-w-screen-xl max-h-screen h-screen overflow-y-scroll"
49 <div className="flex justify-between w-full items-center flex-shrink-0">
50 <div className="type-ui text-wall-500">{props.breadcrumbs}</div>
51 <div className="hidden md:block">
55 props.search.toggleSearch();
57 className="bg-wall-100 text-wall-500 flex px-4 py-1 rounded-lg type-ui"
59 Search<div className="ml-4 text-wall-400">{shortcut}</div>
63 <div className="w-full flex justify-center">
65 <Section narrow className={""}>
66 <h2 className="mb-16 mt-24">{props.title}</h2>
68 <div className="pb-32" />
71 <div className="min-w-0">
72 <h2 className="mb-16 mt-24">{props.title}</h2>
74 <div className="pb-32" />
78 key={props.params.slug?.join("/") || Math.random()}
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