on master help sign in
TableOfContents: hide sidebar if only one header
commit85b55004db61f78f9e4395e330216fd67bb3449b authorMatilde Park <matilde.park@urbit.org> dateTue 14 Jun 2022, 10:59 (4 years ago) parent0f28e8c
1 file changed+2−1
components/TableOfContents.js+2−1
components/TableOfContents.js+2−1
@@ -1,4 +1,5 @@
11import { useState, useEffect, useRef } from "react";
2+import classNames from "classnames";
23
34export const TableOfContents = ({ staticPosition, noh3s }) => {
45 const { nestedHeadings } = useHeadingsData(noh3s);
@@ -51,7 +52,7 @@ const useHeadingsData = (noh3s) => {
5152};
5253
5354const Headings = ({ headings, activeId }) => (
54− <ul>
55+ <ul className={classNames({ hidden: headings.length === 1 })}>
5556 {headings.map((heading, index) => (
5657 <li key={heading.id}>
5758 <a