From 30b013ae8eacd04b1b8a41ce2ed0dd50c8ebae25 Mon Sep 17 00:00:00 2001 From: claudiahdz Date: Thu, 7 Nov 2019 20:14:47 +0200 Subject: [PATCH] feat(docs): add UI state to docs website --- docs/gatsby-browser.js | 12 +++++------- docs/gatsby-ssr.js | 6 ++++++ docs/src/components/FoundTypo.js | 2 +- docs/src/components/home/DarkBlock.js | 1 - docs/src/components/home/Terminal.js | 2 +- docs/src/components/layout.js | 12 +++++++++--- docs/src/pages/404.js | 17 +++++------------ docs/src/pages/index.js | 19 ++++++------------- docs/src/templates/Page.js | 18 ++++++------------ 9 files changed, 39 insertions(+), 50 deletions(-) create mode 100644 docs/gatsby-ssr.js diff --git a/docs/gatsby-browser.js b/docs/gatsby-browser.js index 035a4dc0398b8..b1425d1fb58cf 100644 --- a/docs/gatsby-browser.js +++ b/docs/gatsby-browser.js @@ -1,10 +1,8 @@ +import React from 'react' +import Layout from './src/components/layout' require('prismjs/themes/prism-tomorrow.css') require('./src/main.css') -/** - * Implement Gatsby's Browser APIs in this file. - * - * See: https://www.gatsbyjs.org/docs/browser-apis/ - */ - -// You can delete this file if you're not using it +export const wrapPageElement = ({ element, props }) => { + return {element} +} diff --git a/docs/gatsby-ssr.js b/docs/gatsby-ssr.js new file mode 100644 index 0000000000000..33361c0a38ca7 --- /dev/null +++ b/docs/gatsby-ssr.js @@ -0,0 +1,6 @@ +import React from 'react' +import Layout from './src/components/layout' + +export const wrapPageElement = ({ element, props }) => { + return {element} +} diff --git a/docs/src/components/FoundTypo.js b/docs/src/components/FoundTypo.js index b92f9a09cfd54..5aca0894934dc 100644 --- a/docs/src/components/FoundTypo.js +++ b/docs/src/components/FoundTypo.js @@ -10,7 +10,7 @@ const Container = styled.div` const FoundTypo = () => { return ( -

👀 Found a typo? Let us know!

+

👀 Found a typo? Let us know!

The current stable version of npm is here. To upgrade, run: npm install npm@latest -g

To report bugs or submit feature requests for the docs, please post here. diff --git a/docs/src/components/home/DarkBlock.js b/docs/src/components/home/DarkBlock.js index ebe77533141c1..bba6a9fc51b3d 100644 --- a/docs/src/components/home/DarkBlock.js +++ b/docs/src/components/home/DarkBlock.js @@ -30,7 +30,6 @@ const DarkBlock = () => {

The current stable version of npm is available on GitHub.

To upgrade, run: npm install npm@latest -g

-

To report bugs or submit feature requests, please XXX.

read docs diff --git a/docs/src/components/home/Terminal.js b/docs/src/components/home/Terminal.js index 20ebb0f73d455..19d890cb98057 100644 --- a/docs/src/components/home/Terminal.js +++ b/docs/src/components/home/Terminal.js @@ -78,7 +78,7 @@ const Bracket = styled.span` margin-top: 10px; ` -const Text = styled.strong` +const Text = styled.span` font-size: 15px; font-weight: 400; letter-spacing: 1px; diff --git a/docs/src/components/layout.js b/docs/src/components/layout.js index 5fab7b22a7dbc..cc6caa3ef6005 100644 --- a/docs/src/components/layout.js +++ b/docs/src/components/layout.js @@ -2,16 +2,22 @@ import React from 'react' import Navbar from './Navbar' import Sidebar from './Sidebar' import {Flex, Box} from 'rebass' +import { theme } from 'src/theme' +import { ThemeProvider } from 'styled-components' + +const IS_STATIC = process.env.GATSBY_IS_STATIC + +const Layout = ({children, path}) => { + const showSidebar = IS_STATIC || path.match(/cli-commands|configuring-npm|using-npm/) -const Layout = ({children, showSidebar}) => { return ( - + {showSidebar && } {children} - + ) } diff --git a/docs/src/pages/404.js b/docs/src/pages/404.js index 5acc8fedb2fc3..aa06a9d10cb9d 100644 --- a/docs/src/pages/404.js +++ b/docs/src/pages/404.js @@ -1,19 +1,12 @@ import React from 'react' - -import Layout from 'src/components/Layout' import SEO from 'src/components/seo' -import {ThemeProvider} from 'styled-components' -import {theme} from 'src/theme' - const NotFoundPage = () => ( - - - -

NOT FOUND

-

You just hit a route that doesn't exist... the sadness.

-
-
+ + +

NOT FOUND

+

You just hit a route that doesn't exist... the sadness.

+
) export default NotFoundPage diff --git a/docs/src/pages/index.js b/docs/src/pages/index.js index 992aee5f06534..6e59f79b2e645 100644 --- a/docs/src/pages/index.js +++ b/docs/src/pages/index.js @@ -1,23 +1,16 @@ import React from 'react' -import Layout from 'src/components/Layout' import Features from 'src/components/home/Features' import SEO from 'src/components/seo' import Hero from 'src/components/home/Hero' import DarkBlock from 'src/components/home/DarkBlock' -import Footer from 'src/components/home/footer' -import {ThemeProvider} from 'styled-components' -import {theme} from 'src/theme' const IndexPage = () => ( - - - - - - -