From 2e6dec7ef4ff567a0d2681dc3e272c54210e59d1 Mon Sep 17 00:00:00 2001
From: Julie Thezenas <julie@lydra.fr>
Date: Thu, 2 Jun 2022 09:54:08 +0000
Subject: [PATCH] fix: Expand TOC

---
 src/theme/MDXPage/index.d.ts        |  4 +++
 src/theme/MDXPage/index.js          | 48 +++++++++++++++++++++++++++++
 src/theme/MDXPage/styles.module.css |  3 ++
 3 files changed, 55 insertions(+)
 create mode 100644 src/theme/MDXPage/index.d.ts
 create mode 100644 src/theme/MDXPage/index.js
 create mode 100644 src/theme/MDXPage/styles.module.css

diff --git a/src/theme/MDXPage/index.d.ts b/src/theme/MDXPage/index.d.ts
new file mode 100644
index 0000000..34b2958
--- /dev/null
+++ b/src/theme/MDXPage/index.d.ts
@@ -0,0 +1,4 @@
+/// <reference types="@docusaurus/plugin-content-pages" />
+/// <reference types="react" />
+import type { Props } from '@theme/MDXPage';
+export default function MDXPage(props: Props): JSX.Element;
diff --git a/src/theme/MDXPage/index.js b/src/theme/MDXPage/index.js
new file mode 100644
index 0000000..fd944c0
--- /dev/null
+++ b/src/theme/MDXPage/index.js
@@ -0,0 +1,48 @@
+import React from 'react';
+import clsx from 'clsx';
+import {
+  PageMetadata,
+  HtmlClassNameProvider,
+  ThemeClassNames,
+} from '@docusaurus/theme-common';
+import Layout from '@theme/Layout';
+import MDXContent from '@theme/MDXContent';
+import TOC from '@theme/TOC';
+import styles from './styles.module.css';
+export default function MDXPage(props) {
+  const {content: MDXPageContent} = props;
+  const {
+    metadata: {title, description, frontMatter},
+  } = MDXPageContent;
+  const {wrapperClassName, hide_table_of_contents: hideTableOfContents} =
+    frontMatter;
+  return (
+    <HtmlClassNameProvider
+      className={clsx(
+        wrapperClassName ?? ThemeClassNames.wrapper.mdxPages,
+        ThemeClassNames.page.mdxPage,
+      )}>
+      <PageMetadata title={title} description={description} />
+      <Layout>
+        <main className="container container--fluid margin-vert--lg">
+          <div className={clsx('row', styles.mdxPageWrapper)}>
+            <div className={clsx('col', !hideTableOfContents && 'col--8')}>
+              <MDXContent>
+                <MDXPageContent />
+              </MDXContent>
+            </div>
+            {!hideTableOfContents && MDXPageContent.toc && (
+              <div className="col col--3">
+                <TOC
+                  toc={MDXPageContent.toc}
+                  minHeadingLevel={frontMatter.toc_min_heading_level}
+                  maxHeadingLevel={frontMatter.toc_max_heading_level}
+                />
+              </div>
+            )}
+          </div>
+        </main>
+      </Layout>
+    </HtmlClassNameProvider>
+  );
+}
diff --git a/src/theme/MDXPage/styles.module.css b/src/theme/MDXPage/styles.module.css
new file mode 100644
index 0000000..3392df2
--- /dev/null
+++ b/src/theme/MDXPage/styles.module.css
@@ -0,0 +1,3 @@
+.mdxPageWrapper {
+  justify-content: center;
+}
-- 
GitLab