From 2d074a7d365c74f1a1a8b454ccad072e87e177e9 Mon Sep 17 00:00:00 2001 From: eliot-akira Date: Tue, 8 Oct 2024 15:33:03 +0200 Subject: [PATCH] Add Root component for app-wide context and stateful logic; Improve max width for example page templates; List examples at root level of site menu instead of under a dropdown --- docs/sidebars.ts | 21 +++++++++++---------- docs/style.scss | 7 +++++++ src/theme/Root.jsx | 12 ++++++++++++ 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 src/theme/Root.jsx diff --git a/docs/sidebars.ts b/docs/sidebars.ts index cb252f9..746830f 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -43,16 +43,17 @@ const sidebars: SidebarsConfig = { 'content', 'layout', 'utilities', - { type: 'html', value: `
`}, - { - type: 'category', - label: 'Examples', - link: { - type: 'generated-index', - title: 'Examples', - }, - items: [{ type: 'autogenerated', dirName: 'examples' }] - }, + { type: 'html', value: `
Examples`}, + { type: 'autogenerated', dirName: 'examples' }, + // { + // type: 'category', + // label: 'Examples', + // link: { + // type: 'generated-index', + // title: 'Examples', + // }, + // items: [{ type: 'autogenerated', dirName: 'examples' }] + // }, ], } diff --git a/docs/style.scss b/docs/style.scss index 1ea831f..a5baa48 100644 --- a/docs/style.scss +++ b/docs/style.scss @@ -84,3 +84,10 @@ $data-theme-prefix: ''; --ifm-footer-background-color: #242526; // #303846 } } + +// Give content more width when no sidebar +@media (min-width: 997px) { + #__docusaurus .docItemCol_node_modules-\@docusaurus-theme-classic-lib-theme-DocItem-Layout-styles-module { + max-width: 100% !important; + } +} \ No newline at end of file diff --git a/src/theme/Root.jsx b/src/theme/Root.jsx new file mode 100644 index 0000000..aeaba68 --- /dev/null +++ b/src/theme/Root.jsx @@ -0,0 +1,12 @@ +import React from 'react' + +/** + * Add stateful logic that is not re-initialized across navigations + * @see https://docusaurus.io/docs/next/swizzling#wrapper-your-site-with-root + */ +export default function Root({ children }) { + + // TODO: React Context provider + + return <>{children} +}