From 15e35fcbeb20bc297adfbb1a6dfe815c0800b84e Mon Sep 17 00:00:00 2001 From: checktheroads Date: Sat, 29 Feb 2020 08:59:29 -0700 Subject: [PATCH] docs updates [skip ci] --- docs/docs/agent.mdx | 11 ++++ docs/docs/license.mdx | 30 +++++++++ docs/docs/styles.module.css | 4 ++ docs/package.json | 4 +- docs/sidebars.js | 22 +++---- docs/src/components/Datetime.js | 7 ++ docs/src/css/custom.css | 2 +- docs/src/theme/Navbar/index.js | 87 ++++++++++++++++--------- docs/src/theme/Navbar/styles.module.css | 1 - docs/yarn.lock | 45 ++++++++++++- 10 files changed, 166 insertions(+), 47 deletions(-) create mode 100644 docs/docs/agent.mdx create mode 100644 docs/docs/license.mdx create mode 100644 docs/src/components/Datetime.js diff --git a/docs/docs/agent.mdx b/docs/docs/agent.mdx new file mode 100644 index 0000000..d39c07f --- /dev/null +++ b/docs/docs/agent.mdx @@ -0,0 +1,11 @@ +--- +id: agent +title: Linux Agent +sidebar_label: Linux Agent +keywords: [configuration, linux, frr, frrouting, bird, agent] +description: hyperglass agent configuration +--- + +:::important Coming Soon +Documentation for [hyperglass-agent](https://github.com/checktheroads/hyperglass-agent) coming soon! +::: diff --git a/docs/docs/license.mdx b/docs/docs/license.mdx new file mode 100644 index 0000000..fee0996 --- /dev/null +++ b/docs/docs/license.mdx @@ -0,0 +1,30 @@ +--- +id: license +title: License +sidebar_label: License +keywords: [hyperglass, license, open source] +description: hyperglass License +--- + +import Datetime from "../src/components/Datetime"; +import styles from "./styles.module.css"; + +### The Clear BSD License + +Copyright © Matthew Love + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/docs/docs/styles.module.css b/docs/docs/styles.module.css index 4a3bb7f..26bced1 100644 --- a/docs/docs/styles.module.css +++ b/docs/docs/styles.module.css @@ -1,3 +1,7 @@ .getStarted[class][class]:not(.button--active):not(:hover) { color: var(--ifm-color-secondary); } + +.year { + color: var(--ifm-color-primary); +} diff --git a/docs/package.json b/docs/package.json index 338eeac..9ecc520 100755 --- a/docs/package.json +++ b/docs/package.json @@ -15,7 +15,9 @@ "prismjs": "^1.19.0", "prop-types": "^15.7.2", "react": "^16.8.4", - "react-dom": "^16.8.4" + "react-dark-mode-toggle": "^0.0.3", + "react-dom": "^16.8.4", + "use-media": "^1.4.0" }, "browserslist": { "production": [ diff --git a/docs/sidebars.js b/docs/sidebars.js index 5727ef7..df8aeed 100755 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -3,19 +3,15 @@ module.exports = { { type: "category", label: "Installation", - items: [ - "introduction", - "getting-started", - "setup", - "configuration", - "devices", - "ui", - "cache", - "api", - "messages", - "queries" - ] + items: ["introduction", "getting-started", "setup"] }, - { type: "doc", id: "platforms" } + { + type: "category", + label: "Configuration", + items: ["configuration", "devices", "ui", "cache", "api", "messages", "queries"] + }, + { type: "doc", id: "platforms" }, + { type: "doc", id: "agent" }, + { type: "doc", id: "license" } ] }; diff --git a/docs/src/components/Datetime.js b/docs/src/components/Datetime.js new file mode 100644 index 0000000..9830cae --- /dev/null +++ b/docs/src/components/Datetime.js @@ -0,0 +1,7 @@ +import React from "react"; + +export default ({ year = false, ...props }) => { + const date = new Date(); + const granularity = year ? date.getFullYear() : date.toString(); + return {granularity}; +}; diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css index 43fef73..4df9907 100755 --- a/docs/src/css/custom.css +++ b/docs/src/css/custom.css @@ -32,7 +32,6 @@ --ifm-color-primary-lighter: #ff918f; --ifm-color-primary-lightest: #ffc4c3; --ifm-code-font-size: 95%; - --ifm-navbar-background-color: var(--ifm-background-color); --ifm-font-family-base: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; @@ -68,6 +67,7 @@ html[data-theme="dark"]:root { html[data-theme="dark"] .footer.footer--dark { --ifm-footer-color: var(--ifm-color-emphasis-300); + --ifm-navbar-background-color: var(--ifm-background-color); } .footer.footer--dark { diff --git a/docs/src/theme/Navbar/index.js b/docs/src/theme/Navbar/index.js index a3bce1e..b3f8860 100644 --- a/docs/src/theme/Navbar/index.js +++ b/docs/src/theme/Navbar/index.js @@ -20,6 +20,9 @@ import useThemeContext from "@theme/hooks/useThemeContext"; import useHideableNavbar from "@theme/hooks/useHideableNavbar"; import useLockBodyScroll from "@theme/hooks/useLockBodyScroll"; +import DarkModeToggle from "react-dark-mode-toggle"; +import useMedia from "use-media"; + import Logo from "../../components/Logo"; import styles from "./styles.module.css"; @@ -59,6 +62,8 @@ function Navbar() { const { isDarkTheme, setLightTheme, setDarkTheme } = useThemeContext(); const { navbarRef, isNavbarVisible } = useHideableNavbar(hideOnScroll); + const isMobile = useMedia({ maxWidth: 997 }); + useLockBodyScroll(sidebarShown); const showSidebar = useCallback(() => { @@ -68,10 +73,23 @@ function Navbar() { setSidebarShown(false); }, [setSidebarShown]); - const onToggleChange = useCallback(e => (e.target.checked ? setDarkTheme() : setLightTheme()), [ - setLightTheme, - setDarkTheme - ]); + // const onToggleChange = useCallback(e => (e.target.checked ? setDarkTheme() : setLightTheme()), [ + // setLightTheme, + // setDarkTheme + // ]); + + // const onToggleChange = e => { + // console.log(e); + // }; + + // const onToggleChange = useCallback(e => (e ? setDarkTheme() : setLightTheme()), [ + // setLightTheme, + // setDarkTheme + // ]); + + const onToggleChange = checked => { + checked ? setDarkTheme() : setLightTheme(); + }; const logoLink = logo.href || baseUrl; const isExternalLogoLink = /http/.test(logoLink); @@ -82,7 +100,8 @@ function Navbar() { } : null; const logoSrc = logo.srcDark && isDarkTheme ? logo.srcDark : logo.src; - const logoImageUrl = useBaseUrl(logoSrc); + + const logoColor = isDarkTheme ? "#ff5e5b" : "inherit"; return (