From fa5ada16316bed886d09f8315286f3d97fd1547f Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Fri, 3 May 2024 14:36:14 -0400 Subject: [PATCH 1/3] add forms sidebar to homepage and center docs content blocks --- client/{src/pages => docs}/index.md | 1 + client/sidebars.js | 28 ---------------------------- client/src/css/custom.css | 17 +++++------------ 3 files changed, 6 insertions(+), 40 deletions(-) rename client/{src/pages => docs}/index.md (91%) diff --git a/client/src/pages/index.md b/client/docs/index.md similarity index 91% rename from client/src/pages/index.md rename to client/docs/index.md index 6b044b6..3b84c09 100644 --- a/client/src/pages/index.md +++ b/client/docs/index.md @@ -1,5 +1,6 @@ --- title: Intro +displayed_sidebar: formsSidebar --- # Let's test the web! diff --git a/client/sidebars.js b/client/sidebars.js index 5a337b4..d929de0 100644 --- a/client/sidebars.js +++ b/client/sidebars.js @@ -1,33 +1,5 @@ -/** - * Creating a sidebar enables you to: - - create an ordered group of docs - - render a sidebar for each doc of that group - - provide next/previous navigation - - The sidebars can be generated from the filesystem, or explicitly defined here. - - Create as many sidebars as you want. - */ - -// @ts-check - -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { - // By default, Docusaurus generates a sidebar from the docs folder structure formsSidebar: [{ type: "autogenerated", dirName: "forms" }], - - // But you can create a sidebar manually - /* - tutorialSidebar: [ - 'intro', - 'hello', - { - type: 'category', - label: 'Tutorial', - items: ['tutorial-basics/create-a-document'], - }, - ], - */ }; module.exports = sidebars; diff --git a/client/src/css/custom.css b/client/src/css/custom.css index 101869b..de1df33 100644 --- a/client/src/css/custom.css +++ b/client/src/css/custom.css @@ -59,18 +59,6 @@ --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); } -.theme-doc-markdown > header:first-of-type details > summary { - list-style: none; -} -.theme-doc-markdown > header:first-of-type details > summary::after { - font-size: 24px; - content: " ▸"; -} -.theme-doc-markdown > header:first-of-type details[open] > summary::after { - font-size: 24px; - content: " ▾"; -} - .theme-doc-markdown > header:first-of-type h1:first-of-type { display: inline-block; cursor: pointer; @@ -78,6 +66,11 @@ margin-bottom: 5px; } +main [class^="docItemCol_"], +main [class*=" docItemCol_"] { + margin: auto; +} + select, input:not([type]), /* text type is stripped from built html */ input[type="url"], From 0b672217fde9e1df24da7c57b4bdfe16193cb035 Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Fri, 3 May 2024 14:37:24 -0400 Subject: [PATCH 2/3] remove workaround for preventing unused searchbar from taking up whitespace --- client/sidebars.js | 4 +++ client/src/theme/Navbar/Search/index.js | 10 ------ .../src/theme/Navbar/Search/styles.module.css | 31 ------------------- 3 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 client/src/theme/Navbar/Search/index.js delete mode 100644 client/src/theme/Navbar/Search/styles.module.css diff --git a/client/sidebars.js b/client/sidebars.js index d929de0..28e93dc 100644 --- a/client/sidebars.js +++ b/client/sidebars.js @@ -1,4 +1,8 @@ +// @ts-check + +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { + // By default, Docusaurus generates a sidebar from the docs folder structure formsSidebar: [{ type: "autogenerated", dirName: "forms" }], }; diff --git a/client/src/theme/Navbar/Search/index.js b/client/src/theme/Navbar/Search/index.js deleted file mode 100644 index 551343c..0000000 --- a/client/src/theme/Navbar/Search/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from "react"; -import clsx from "clsx"; -import styles from "./styles.module.css"; -export default function NavbarSearch({ children, className }) { - return ( -
- {children} -
- ); -} diff --git a/client/src/theme/Navbar/Search/styles.module.css b/client/src/theme/Navbar/Search/styles.module.css deleted file mode 100644 index fa17b4c..0000000 --- a/client/src/theme/Navbar/Search/styles.module.css +++ /dev/null @@ -1,31 +0,0 @@ -/* -Workaround to avoid rendering empty search container -See https://github.com/facebook/docusaurus/pull/9385 -*/ -/* -TODO temporary @supports check, remove before 2025 -only needed for Firefox < 121 -see https://github.com/facebook/docusaurus/issues/9527#issuecomment-1805272379 - */ -@supports selector(:has(*)) { - .navbarSearchContainer:not(:has(> *)) { - display: none; - } -} - -/* Remove styling which causes the navbar to take up whitespace when not used. */ -/* -@media (max-width: 996px) { - .navbarSearchContainer { - position: absolute; - right: var(--ifm-navbar-padding-horizontal); - } -} - -@media (min-width: 997px) { - .navbarSearchContainer { - padding: var(--ifm-navbar-item-padding-vertical) - var(--ifm-navbar-item-padding-horizontal); - } -} -*/ From 4da61517cd87c22ce18c92d95a4f19de38d9c26a Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Fri, 3 May 2024 14:53:38 -0400 Subject: [PATCH 3/3] redorder forms sidebar items, collapse all but login by default, and fix incorrect filename for Create items --- .../docs/forms/create/{__category__.json => _category_.json} | 3 ++- client/docs/forms/identity/_category_.json | 3 ++- client/docs/forms/login/_category_.json | 4 ++-- client/docs/forms/payment/_category_.json | 3 ++- client/docs/forms/search/_category_.json | 3 ++- client/docs/forms/update/_category_.json | 3 ++- client/docusaurus.config.ts | 4 ++++ 7 files changed, 16 insertions(+), 7 deletions(-) rename client/docs/forms/create/{__category__.json => _category_.json} (78%) diff --git a/client/docs/forms/create/__category__.json b/client/docs/forms/create/_category_.json similarity index 78% rename from client/docs/forms/create/__category__.json rename to client/docs/forms/create/_category_.json index 2da38ee..9b136d1 100644 --- a/client/docs/forms/create/__category__.json +++ b/client/docs/forms/create/_category_.json @@ -1,8 +1,9 @@ { + "collapsed": true, "label": "Create", "link": { "type": "generated-index", "description": "Common patterns for account creation forms" }, - "collapsed": false + "position": 5 } diff --git a/client/docs/forms/identity/_category_.json b/client/docs/forms/identity/_category_.json index 7b624a2..13371ed 100644 --- a/client/docs/forms/identity/_category_.json +++ b/client/docs/forms/identity/_category_.json @@ -1,8 +1,9 @@ { + "collapsed": true, "label": "Identity", "link": { "type": "generated-index", "description": "Common patterns for identity forms" }, - "collapsed": false + "position": 2 } diff --git a/client/docs/forms/login/_category_.json b/client/docs/forms/login/_category_.json index 99f6b4c..c92d027 100644 --- a/client/docs/forms/login/_category_.json +++ b/client/docs/forms/login/_category_.json @@ -1,9 +1,9 @@ { + "collapsed": false, "label": "Login", - "position": 1, "link": { "type": "generated-index", "description": "Common patterns for login forms" }, - "collapsed": false + "position": 1 } diff --git a/client/docs/forms/payment/_category_.json b/client/docs/forms/payment/_category_.json index 840fb62..bd9d9b6 100644 --- a/client/docs/forms/payment/_category_.json +++ b/client/docs/forms/payment/_category_.json @@ -1,8 +1,9 @@ { + "collapsed": true, "label": "Payment", "link": { "type": "generated-index", "description": "Common patterns for payment forms" }, - "collapsed": false + "position": 3 } diff --git a/client/docs/forms/search/_category_.json b/client/docs/forms/search/_category_.json index f48af43..9c0b853 100644 --- a/client/docs/forms/search/_category_.json +++ b/client/docs/forms/search/_category_.json @@ -1,8 +1,9 @@ { + "collapsed": true, "label": "Search", "link": { "type": "generated-index", "description": "Common patterns for search inputs" }, - "collapsed": false + "position": 4 } diff --git a/client/docs/forms/update/_category_.json b/client/docs/forms/update/_category_.json index 1a41fb0..02b4cc6 100644 --- a/client/docs/forms/update/_category_.json +++ b/client/docs/forms/update/_category_.json @@ -1,8 +1,9 @@ { + "collapsed": true, "label": "Update", "link": { "type": "generated-index", "description": "Common patterns for authentication update forms" }, - "collapsed": false + "position": 6 } diff --git a/client/docusaurus.config.ts b/client/docusaurus.config.ts index 01612b9..2eff7d4 100644 --- a/client/docusaurus.config.ts +++ b/client/docusaurus.config.ts @@ -51,6 +51,10 @@ const config: Config = { { docs: { breadcrumbs: false, + // @TODO there is a known issue where docs `routeBasePath` set to "/" breaks 404 pages + // https://github.com/facebook/docusaurus/issues/9665 + // https://github.com/facebook/docusaurus/issues/9688 + routeBasePath: "/", sidebarPath: require.resolve("./sidebars.js"), },