From 592ef2f71c2c667290a08a2fd6545bf3185310bc Mon Sep 17 00:00:00 2001 From: aeneasr Date: Tue, 6 Jul 2021 09:07:12 +0000 Subject: [PATCH] chore: update docusaurus template Signed-off-by: aeneasr --- docs/docusaurus.config.js | 28 +++------------------------- docs/package-lock.json | 2 ++ docs/package.json | 2 +- docs/src/theme/API.js | 25 +++++++++++++++++++++++++ docs/src/theme/API.module.css | 20 ++++++++++++++++++++ 5 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 docs/src/theme/API.js create mode 100644 docs/src/theme/API.module.css diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index e42b9b51d72f..e127c2e3c92f 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -11,30 +11,7 @@ let links = [ to: 'https://www.ory.sh/', label: `Home`, position: 'left' - } -] - -if (config.enableRedoc) { - links = [ - ...links, - { - to: baseUrl, - label: `Docs`, - position: 'left', - activeBaseRegex: '/docs/(?!http-api).*' - }, - { - type: 'docsVersion', - position: 'left', - to: '/http-api', - label: 'HTTP API', - docsPluginId: 'default' - } - ] -} - -links = [ - ...links, + }, { href: `https://github.com/ory/${githubRepoName}/discussions`, label: 'Discussions', @@ -220,6 +197,7 @@ module.exports = { customCss } ], - '@docusaurus/theme-search-algolia' + '@docusaurus/theme-search-algolia', + 'docusaurus-theme-redoc' ] } diff --git a/docs/package-lock.json b/docs/package-lock.json index c442fe944b8a..e848af1a63ff 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "docusaurus-template", "version": "0.0.0", "dependencies": { "@docusaurus/core": "2.0.0-beta.3", @@ -14,6 +15,7 @@ "@docusaurus/theme-classic": "2.0.0-beta.3", "@docusaurus/theme-search-algolia": "2.0.0-beta.3", "classnames": "2.3.1", + "docusaurus-theme-redoc": "^0.4.4", "file-loader": "6.2.0", "mermaid": "8.11.0", "node-fetch": "2.6.1", diff --git a/docs/package.json b/docs/package.json index e5de7a68c2a7..fd6bc1390c66 100644 --- a/docs/package.json +++ b/docs/package.json @@ -53,9 +53,9 @@ ] }, "devDependencies": { - "npm-run-all": "^4.1.5", "json-schema-faker": "0.5.0-rcv.35", "json-schema-ref-parser": "9.0.9", + "npm-run-all": "^4.1.5", "ory-prettier-styles": "1.1.2", "prettier": "2.3.2", "ramda": "0.27.1", diff --git a/docs/src/theme/API.js b/docs/src/theme/API.js new file mode 100644 index 000000000000..2bcc0ca3432a --- /dev/null +++ b/docs/src/theme/API.js @@ -0,0 +1,25 @@ +import React from 'react' +import useBaseUrl from '@docusaurus/useBaseUrl' +import { useActiveVersion } from '@theme/hooks/useDocs' +import Redoc from '@theme/Redoc' +import styles from './API.module.css' + +function join(...args) { + return args + .map((part, i) => { + if (i === 0) { + return part.trim().replace(/[\/]*$/g, '') + } else { + return part.trim().replace(/(^[\/]*|[\/]*$)/g, '') + } + }) + .filter((x) => x.length) + .join('/') +} + +function API({ spec }) { + const { path } = useActiveVersion() + return +} + +export default API diff --git a/docs/src/theme/API.module.css b/docs/src/theme/API.module.css new file mode 100644 index 000000000000..0c6bb7eba339 --- /dev/null +++ b/docs/src/theme/API.module.css @@ -0,0 +1,20 @@ +:global .container { + width: 100%; + max-width: 100%; +} + +:global main { + max-width: 100% !important; +} + +:global .container .col { + width: 100% !important; + max-width: 100% !important; +} + +:global .container .col.col--3 { + display: none; +} + +:global .container .col { +}