You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by su...@apache.org on 2021/06/10 16:14:13 UTC
[apisix-website] branch master updated: feat: added doc name to doc
dropdown selection (#361)
This is an automated email from the ASF dual-hosted git repository.
sunyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git
The following commit(s) were added to refs/heads/master by this push:
new f6f5283 feat: added doc name to doc dropdown selection (#361)
f6f5283 is described below
commit f6f528334bbbd6bb5e2345847e63bd6687b87926
Author: Ayush das <ay...@gmail.com>
AuthorDate: Thu Jun 10 21:43:42 2021 +0530
feat: added doc name to doc dropdown selection (#361)
---
website/src/theme/DocPage/index.js | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/website/src/theme/DocPage/index.js b/website/src/theme/DocPage/index.js
index 11ae324..7f98e47 100644
--- a/website/src/theme/DocPage/index.js
+++ b/website/src/theme/DocPage/index.js
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
-import React, { useState, useCallback } from "react";
+import React, { useState, useCallback, useEffect } from "react";
import { MDXProvider } from "@mdx-js/react";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import renderRoutes from "@docusaurus/renderRoutes";
@@ -26,6 +26,34 @@ function DocPageContent({ currentDocRoute, versionMetadata, children }) {
docsSidebars,
version,
} = versionMetadata;
+
+ const pageId = {
+ general : "General",
+ apisix : "getting-started",
+ apisixDashboard : "dashboard",
+ apisixIngressController : "what-is-apisix-ingress-controller",
+ apisixHelmChart : "dependencies",
+ apisixDocker : "build-an-image-from-source"
+ }
+ useEffect(() => {
+ if(docsSidebars[sidebarName][0].label === pageId.general){
+ document.querySelectorAll(".navbar__link--active")[0].text = "General";
+ } else if (document.getElementById(pageId.apisix)) {
+ document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX";
+ } else if (document.getElementById(pageId.apisixDashboard)) {
+ document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX Dashboard";
+ } else if (document.getElementById(pageId.apisixIngressController)) {
+ document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX Ingress Controller";
+ } else if (document.getElementById(pageId.apisixHelmChart)) {
+ document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX™ Helm Chart";
+ } else if (document.getElementById(pageId.apisixDocker)) {
+ document.querySelectorAll(".navbar__link--active")[0].text = "Apache APISIX™ Docker";
+ }
+ return () => {
+ console.log('\u{1F680} documentation changed')
+ }
+ }, []);
+
const sidebarName = permalinkToSidebar[currentDocRoute.path];
const sidebar = docsSidebars[sidebarName];
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
@@ -34,7 +62,6 @@ function DocPageContent({ currentDocRoute, versionMetadata, children }) {
if (hiddenSidebar) {
setHiddenSidebar(false);
}
-
setHiddenSidebarContainer(!hiddenSidebarContainer);
}, [hiddenSidebar]);
return (