-
+
+
-
+
{renderRoutes(route.routes, {docsMetadata})}
-
+
diff --git a/packages/docusaurus-plugin-content-docs/src/theme/DocPage/styles.css b/packages/docusaurus-plugin-content-docs/src/theme/DocPage/styles.css
deleted file mode 100644
index f44d83b29e..0000000000
--- a/packages/docusaurus-plugin-content-docs/src/theme/DocPage/styles.css
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright (c) 2017-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
- /**
- * width 19rem is calculated according to (sidebarWidth - sidebarPadding)
- * i.e 20rem - ( 0.5rem + 0.5rem )
- * Todo - 0.5rem and 20rem should be a css variable
- */
-
- @media (min-width: 996px) {
- .sidebar__container {
- width: 19rem;
- float: left;
- min-height: calc(100vh - var(--ifm-navbar-height));
- }
- .content__container {
- margin: 0 0 0 19rem;
- }
-}
diff --git a/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/index.js b/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/index.js
index 4d16f6e4a2..f15e008ed4 100644
--- a/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/index.js
+++ b/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/index.js
@@ -5,13 +5,17 @@
* LICENSE file in the root directory of this source tree.
*/
-import React from 'react';
+import React, {useState} from 'react';
+import classnames from 'classnames';
import Link from '@docusaurus/Link'; // eslint-disable-line
-import './styles.css';
+import styles from './styles.module.css';
+
+const MOBILE_TOGGLE_SIZE = 24;
function DocSidebar(props) {
+ const [showResponsiveSidebar, setShowResponsiveSidebar] = useState(false);
const {docsMetadata, sidebar} = props;
if (!sidebar) {
@@ -59,7 +63,10 @@ function DocSidebar(props) {
+ to={item.href}
+ onClick={() => {
+ setShowResponsiveSidebar(false);
+ }}>
{item.label}
@@ -72,10 +79,50 @@ function DocSidebar(props) {
};
return (
-
-
- {thisSidebar.map(item => renderItem(item, {root: true}))}
-
+
+
+
+
+ {thisSidebar.map(item => renderItem(item, {root: true}))}
+
+
);
}
diff --git a/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/styles.css b/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/styles.css
deleted file mode 100644
index b7db6c4fd8..0000000000
--- a/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/styles.css
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) 2017-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
-@media (min-width: 996px) {
- .sidebar {
- border-right: 1px solid #dadde1;
- bottom: 0;
- box-sizing: border-box;
- padding: 0.5rem;
- left: 0;
- position: fixed;
- overflow-x: hidden;
- overflow-y: auto;
- top: var(--ifm-navbar-height);
- width: 20rem;
- }
-}
diff --git a/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/styles.module.css b/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/styles.module.css
new file mode 100644
index 0000000000..f39d45fdbe
--- /dev/null
+++ b/packages/docusaurus-plugin-content-docs/src/theme/DocSidebar/styles.module.css
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2017-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+@media (min-width: 997px) {
+ .sidebar {
+ height: calc(100vh - var(--ifm-navbar-height));
+ overflow-y: auto;
+ padding: 0.5rem;
+ position: sticky;
+ top: var(--ifm-navbar-height);
+ }
+}
+
+.sidebarMenuIcon {
+ vertical-align: middle;
+}
+
+.sidebarMenuCloseIcon {
+ display: inline-block;
+ height: 24px;
+ font-size: 1.5rem;
+ font-weight: var(--ifm-font-weight-bold);
+ line-height: 0.9;
+ width: 24px;
+}
diff --git a/packages/docusaurus-theme-classic/src/theme/Navbar/styles.module.css b/packages/docusaurus-theme-classic/src/theme/Navbar/styles.module.css
index 7afd600bdb..a5b0a0a789 100644
--- a/packages/docusaurus-theme-classic/src/theme/Navbar/styles.module.css
+++ b/packages/docusaurus-theme-classic/src/theme/Navbar/styles.module.css
@@ -5,11 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/
-@media screen and (max-width: 996px) {
+@media screen and (max-width: 997px) {
.displayOnlyInLargeViewport {
display: none !important;
}
}
+
.toggle {
align-items: center;
display: flex;
@@ -20,7 +21,7 @@
}
.toggle::before {
position: absolute;
-}
+}
.moon::before {
content: '\1F31C';
}
@@ -28,7 +29,6 @@
content: '\1F31E';
}
-
/**
* styles for React Toggle
* copied over because we want to allow user to swizzle it and modify the css