on master help sign in
docs, contentarea: insert toc inside contentarea
commit3accbdbd00701d79dd35eeee32dff9797a510b59 authorMatilde Park <matilde.park@gmail.com> dateThu 29 Jul 2021, 11:22 (5 years ago) parent3523ab4
5 files changed+6−7
components/ContentArea.js+4 components/TableOfContents.js+1−1 pages/docs/[[...slug]].js+1−2 pages/getting-started/[[...slug]].js−2 pages/using/[[...slug]].js−2
components/ContentArea.js+4
@@ -1,5 +1,6 @@
11import Section from "./Section";
22import { useState, useEffect } from "react";
3+import { TableOfContents } from "./TableOfContents";
34
45export default function ContentArea(props) {
56 const [shortcut, setShortcut] = useState("");
@@ -50,6 +51,9 @@ export default function ContentArea(props) {
5051 <div className="pb-32" />
5152 </div>
5253 )}
54+ <TableOfContents
55+ key={props.params.slug?.join("/") || Math.random()}
56+ />
5357 </div>
5458 </div>
5559 </div>
components/TableOfContents.js+1−1
@@ -8,7 +8,7 @@ export const TableOfContents = ({ staticPosition, noh3s }) => {
88 <nav
99 className={
1010 (staticPosition ? "static" : "sticky") +
11− " min-h-0 overflow-y-auto w-52 flex-shrink-0 pb-24 hidden lg:block"
11+ " min-h-0 overflow-y-auto w-52 flex-shrink-0 pb-24 hidden lg:block pl-4"
1212 }
1313 style={{ top: "8rem", height: "calc(100vh - 16rem)" }}
1414 >
pages/docs/[[...slug]].js+1−2
@@ -17,7 +17,6 @@ import ContentArea from "../../components/ContentArea";
1717import Sidebar from "../../components/Sidebar";
1818import markdownStyles from "../../styles/markdown.module.css";
1919import { decode } from "html-entities";
20−import { TableOfContents } from "../../components/TableOfContents";
2120
2221const breadcrumbs = (posts, paths) => {
2322 const results = [
@@ -144,6 +143,7 @@ export default function DocsLayout({
144143 title={data.title}
145144 search={search}
146145 section="Urbit Documentation"
146+ params={params}
147147 >
148148 <div className={markdownStyles["markdown"]}>
149149 <article
@@ -175,7 +175,6 @@ export default function DocsLayout({
175175 )}
176176 </div>
177177 </ContentArea>
178− <TableOfContents key={params.slug?.join("/") || "docs"} />
179178 </div>
180179 </>
181180 );
pages/getting-started/[[...slug]].js−2
@@ -7,7 +7,6 @@ import { join } from "path";
77import { buildPageTree, getPage } from "../../lib/lib";
88import Markdown from "../../components/Markdown";
99import ContentArea from "../../components/ContentArea";
10−import { TableOfContents } from "../../components/TableOfContents";
1110import Sidebar from "../../components/Sidebar";
1211import markdownStyles from "../../styles/markdown.module.css";
1312import { decode } from "html-entities";
@@ -101,7 +100,6 @@ export default function UsingLayout({ posts, data, params, search, markdown }) {
101100 ></article>
102101 </div>
103102 </ContentArea>
104− <TableOfContents key={params.slug?.join("/") || "getting-started"} />
105103 </div>
106104 </>
107105 );
pages/using/[[...slug]].js−2
@@ -8,7 +8,6 @@ import { join } from "path";
88import { getDocs, formatDate, buildPageTree, getPage } from "../../lib/lib";
99import Markdown from "../../components/Markdown";
1010import ContentArea from "../../components/ContentArea";
11−import { TableOfContents } from "../../components/TableOfContents";
1211import Sidebar from "../../components/Sidebar";
1312import markdownStyles from "../../styles/markdown.module.css";
1413import { decode } from "html-entities";
@@ -121,7 +120,6 @@ export default function UsingLayout({ posts, data, params, search, markdown }) {
121120 ></article>
122121 </div>
123122 </ContentArea>
124− <TableOfContents key={params.slug?.join("/") || "using"} />
125123 </div>
126124 </>
127125 );