website: move API browser into developer docs
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
11383d76a2
commit
ab021b4b7e
|
@ -0,0 +1,38 @@
|
||||||
|
# API Browser
|
||||||
|
|
||||||
|
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
||||||
|
import useBaseUrl from "@docusaurus/useBaseUrl";
|
||||||
|
import BrowserOnly from "@docusaurus/core/lib/client/exports/BrowserOnly";
|
||||||
|
import { useColorMode } from "@docusaurus/theme-common";
|
||||||
|
|
||||||
|
export function APIBrowser() {
|
||||||
|
const context = useDocusaurusContext();
|
||||||
|
const { siteConfig = {} } = context;
|
||||||
|
const { colorMode, setColorMode } = useColorMode();
|
||||||
|
let bg = "#1b1b1d";
|
||||||
|
if (colorMode === "light") {
|
||||||
|
bg = "#fff";
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<BrowserOnly>
|
||||||
|
{() => {
|
||||||
|
import("rapidoc");
|
||||||
|
return (
|
||||||
|
<rapi-doc
|
||||||
|
spec-url={useBaseUrl("schema.yaml")}
|
||||||
|
allow-try="false"
|
||||||
|
show-header="false"
|
||||||
|
theme={colorMode}
|
||||||
|
bg-color={bg}
|
||||||
|
render-style="view"
|
||||||
|
primary-color="#fd4b2d"
|
||||||
|
allow-spec-url-load="false"
|
||||||
|
allow-spec-file-load="false"
|
||||||
|
></rapi-doc>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</BrowserOnly>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
<APIBrowser />
|
|
@ -30,6 +30,7 @@ module.exports = {
|
||||||
"api/flow-executor",
|
"api/flow-executor",
|
||||||
"api/making-schema-changes",
|
"api/making-schema-changes",
|
||||||
"api/websocket",
|
"api/websocket",
|
||||||
|
"api/browser",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
import React from "react";
|
|
||||||
import Layout from "@theme/Layout";
|
|
||||||
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
|
||||||
import useBaseUrl from "@docusaurus/useBaseUrl";
|
|
||||||
import BrowserOnly from "@docusaurus/core/lib/client/exports/BrowserOnly";
|
|
||||||
|
|
||||||
function APIBrowser() {
|
|
||||||
const context = useDocusaurusContext();
|
|
||||||
const { siteConfig = {} } = context;
|
|
||||||
return (
|
|
||||||
<Layout title="API Browser" description={siteConfig.tagline}>
|
|
||||||
<BrowserOnly>
|
|
||||||
{() => {
|
|
||||||
import("rapidoc");
|
|
||||||
return (
|
|
||||||
<rapi-doc
|
|
||||||
spec-url={useBaseUrl("schema.yaml")}
|
|
||||||
allow-try="false"
|
|
||||||
show-header="false"
|
|
||||||
theme="dark"
|
|
||||||
render-style="view"
|
|
||||||
primary-color="#fd4b2d"
|
|
||||||
allow-spec-url-load="false"
|
|
||||||
allow-spec-file-load="false"
|
|
||||||
></rapi-doc>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</BrowserOnly>
|
|
||||||
</Layout>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default APIBrowser;
|
|
Reference in New Issue