-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update website to latest ocular-gatsby (#991)
<!-- For feature, feature enhancement or bug fix, create an issue first and finish To Do List there --> <!-- Anything doesn't work as expected is a bug, including code, doc and test --> # For #756 <!-- For other PRs without open issue --> #### Background <!-- For all the PRs --> #### Change List -
- Loading branch information
Showing
5 changed files
with
130 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// This component contains the StaticQuery needed to provide data for the layout components. | ||
// These layout components will then pass some of that information down to the rest of the site | ||
// ie to the table of content, header, etc. | ||
|
||
// because this is a StaticQuery it needs to be in the local tree so that its graphQl can be | ||
// run by gatsby. Rather, a file of the same name must have the same query in the local tree. | ||
// During the init process, ocular copies this file over to the local tree. | ||
|
||
|
||
import React from 'react'; | ||
import { StaticQuery, graphql } from 'gatsby'; | ||
|
||
// All common metadata, table-of-contents etc are queried here and put in React context | ||
const QUERY = graphql` | ||
fragment SiteConfigFragment on Site { | ||
siteMetadata { | ||
config { | ||
PROJECT_NAME | ||
PROJECT_TYPE | ||
PROJECT_DESC | ||
HOME_HEADING | ||
HOME_BULLETS { | ||
text | ||
desc | ||
img | ||
} | ||
EXAMPLES { | ||
title | ||
path | ||
} | ||
THEME_OVERRIDES { | ||
key | ||
value | ||
} | ||
} | ||
} | ||
} | ||
fragment MarkdownNodeFragment on MarkdownRemark { | ||
id | ||
fields { | ||
slug | ||
} | ||
frontmatter { | ||
title | ||
} | ||
} | ||
query ConfigQuery { | ||
site { | ||
...SiteConfigFragment | ||
} | ||
allMarkdown: allMarkdownRemark(limit: 2000) { | ||
edges { | ||
node { | ||
...MarkdownNodeFragment | ||
} | ||
} | ||
} | ||
tableOfContents: docsJson { | ||
chapters { | ||
title | ||
level | ||
chapters { | ||
title | ||
level | ||
entries { | ||
id | ||
childMarkdownRemark { | ||
id | ||
frontmatter { | ||
title | ||
} | ||
fields { | ||
slug | ||
} | ||
} | ||
} | ||
} | ||
entries { | ||
id | ||
childMarkdownRemark { | ||
id | ||
frontmatter { | ||
title | ||
} | ||
fields { | ||
slug | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
// The Layout instance is shared between pages. It queries common, static data | ||
// and makes it available on React context | ||
export default class SiteQuery extends React.Component { | ||
render() { | ||
const { onComplete } = this.props; | ||
return <StaticQuery query={QUERY} render={onComplete} />; | ||
} | ||
} |