@@ -7,6 +7,7 @@ import { join } from "path";
7import { getDocs, formatDate, buildPageTree, getPage } from "../../lib/lib";
7import { getDocs, formatDate, buildPageTree, getPage } from "../../lib/lib";
8import Markdown from "../../components/Markdown";
8import Markdown from "../../components/Markdown";
9import Search from "../../components/Search";
9import Search from "../../components/Search";
10+import { configure, GlobalHotKeys } from "react-hotkeys";
11const breadcrumbs = (posts, paths) => {
12const breadcrumbs = (posts, paths) => {
12 const results = [
13 const results = [
@@ -120,11 +121,18 @@ function ContentArea(props) {
121export default function DocsLayout({ posts, data, content, params }) {
122export default function DocsLayout({ posts, data, content, params }) {
122 const [showSearch, toggleSearch] = useState(false);
123 const [showSearch, toggleSearch] = useState(false);
124+ const toggle = () => toggleSearch((state) => !state);
125+ const keyMap = { search: ["command+k", "ctrl+k", "esc"] };
126+ const handlers = { search: toggle };
126 <title>{data.title} / Documentation / Urbit.org</title>
133 <title>{data.title} / Documentation / Urbit.org</title>
135+ <GlobalHotKeys keyMap={keyMap} handlers={handlers} />
128 {showSearch && <Search toggleSearch={() => toggleSearch(!showSearch)} />}
136 {showSearch && <Search toggleSearch={() => toggleSearch(!showSearch)} />}
129 <div className="flex w-screen h-screen min-h-screen w-screen overflow-hidden">
137 <div className="flex w-screen h-screen min-h-screen w-screen overflow-hidden">
130 <Sidebar>{childPages("/docs", posts.children)}</Sidebar>
138 <Sidebar>{childPages("/docs", posts.children)}</Sidebar>