From 1cef2b95a65f984a7fe7b5fb22e4232df98c589e Mon Sep 17 00:00:00 2001 From: KirankumarAmbati Date: Sun, 3 Mar 2019 12:08:44 +0530 Subject: [PATCH 1/2] closes #165: fix for navigation on 404 page --- src/pages/404.tsx | 54 +++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 07990dac18..bc8119c428 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -1,4 +1,4 @@ -import { graphql } from 'gatsby'; +import { StaticQuery, graphql } from 'gatsby'; import React from 'react'; import Hero from '../components/hero'; import Layout from '../components/layout'; @@ -6,38 +6,42 @@ import Navigation from '../components/navigation'; import { LearnPageData } from '../types'; import { findActive } from '../util/findActive'; -type Props = { - data: LearnPageData; -}; - -export default ({ data }: Props) => { +export default () => { // Get current page related data. - const { navigationSections } = findActive(data.sections.group); - const title = `PAGE NOT FOUND`; const description = `You've hit a route that does not exist.`; return ( - - - -
-

{title}

-
-

- The page you're trying to access does not exist. Go back to the - Homepage or find what you're looking for in the menu. -

-

- Take me back to the Homepage → -

-
-
-
+ { + + const { navigationSections } = findActive(data.sections.group); + + return ( + + + +
+

{title}

+
+

+ The page you're trying to access does not exist. Go back to the + Homepage or find what you're looking for in the menu. +

+

+ Take me back to the Homepage → +

+
+
+
+ ) + }} + /> ); }; -export const query = graphql` +const query = graphql` { sections: allMarkdownRemark( sort: { fields: [fileAbsolutePath], order: ASC } From 21e70a7d0eb2f91cd072da96187f4fd82486e3a1 Mon Sep 17 00:00:00 2001 From: Sagir Khan Date: Mon, 4 Mar 2019 01:35:14 +0530 Subject: [PATCH 2/2] Update src/pages/404.tsx Co-Authored-By: KirankumarAmbati --- src/pages/404.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/404.tsx b/src/pages/404.tsx index bc8119c428..ac3ab74dcb 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -14,7 +14,7 @@ export default () => { return ( { + render={(data: LearnPageData) => { const { navigationSections } = findActive(data.sections.group);