Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit

Permalink
new website with ocular-gatsby
Browse files Browse the repository at this point in the history
  • Loading branch information
jerome committed Mar 27, 2019
1 parent 7e85dd8 commit 48a3576
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 0 deletions.
2 changes: 2 additions & 0 deletions website/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
59 changes: 59 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
### Node ###
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity


# Build Files
public/
.cache/

# Gatsby context
.gatsby-context.js

# Bundle stats
bundle-stats.json
1 change: 1 addition & 0 deletions website/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('ocular-gatsby/gatsby-browser');
6 changes: 6 additions & 0 deletions website/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const {getGatsbyConfig, registerReactComponent} = require('ocular-gatsby/api');

const config = require('./ocular-config');

module.exports = getGatsbyConfig(config);

20 changes: 20 additions & 0 deletions website/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const config = require('./ocular-config');
const getGatsbyNodeCallbacks = require('ocular-gatsby/gatsby-node');

module.exports = getGatsbyNodeCallbacks(config);

// NOTE: It is possible to override the ocular-provided callbacks
// and this take control any aspect of gatsby:

// exports.onCreateNode = ({ node, actions, getNode }) =>
// ocular.onCreateNode({ node, actions, getNode });

// exports.setFieldsOnGraphQLNodeType = ({ type, actions }) =>
// ocular.setFieldsOnGraphQLNodeType({ type, actions });

// // This is a main gatsby entry point
// // Here we get to programmatically create pages after all nodes are created
// // by gatsby.
// // We use graphgl to query for nodes and iterate
// exports.createPages = ({ graphql, actions }) =>
// ocular.createPages({ graphql, actions });
1 change: 1 addition & 0 deletions website/gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('ocular-gatsby/gatsby-ssr');
54 changes: 54 additions & 0 deletions website/ocular-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const DOCS = require("../docs/table-of-contents.json");

module.exports = {
DOC_FOLDER: "/Users/jerome/code/viewport-mercator-project/website/../docs/",
ROOT_FOLDER: "/Users/jerome/code/viewport-mercator-project/website/../",

EXAMPLES: [
// {title: 'my example', path: 'examples/my-example/', image: 'images/my-example.jpg'}
],
DOCS,
THEME_OVERRIDES: [
// {key: 'primaryFontFamily', value: 'serif'}
],

PROJECT_TYPE: "github",
PROJECT_NAME: "viewport-mercator-project",
PROJECT_ORG: "uber-common",
PROJECT_URL: "https://github.com/uber-common/viewport-mercator-project",
PROJECT_DESC: "Utilities for working with Web Mercator Projections",
WEBSITE_PATH: "/website/",

FOOTER_LOGO: "",

HOME_PATH: "/",
HOME_HEADING: "Utilities for working with Web Mercator Projections",
HOME_RIGHT: null,
HOME_BULLETS: [],

PROJECTS: {
// 'Project name': 'http://project.url',
},
ADDITIONAL_LINKS: [
// {name: 'link label', href: 'http://link.url'}
],

GA_TRACKING: null,

// For showing star counts and contributors.
// Should be like btoa('YourUsername:YourKey') and should be readonly.
GITHUB_KEY: null,

// TODO/ib - from gatsby starter, clean up
siteTitle: "viewport-mercator-project", // Site title.
siteTitleAlt: "viewport-mercator-project", // Alternative site title for SEO.
siteLogo: "/logos/logo-1024.png", // Logo used for SEO and manifest.
siteUrl: "https://ocular", // Domain of your website without pathPrefix.
pathPrefix: "/viewport-mercator-project", // Prefixes all links. For cases when deployed to example.github.io/gatsby-advanced-starter/.
siteDescription: "viewport-mercator-project", // Website description used for RSS feeds/meta description tag.
siteRss: "/rss.xml", // Path to the RSS file.
dateFromFormat: "YYYY-MM-DD", // Date format used in the frontmatter.
dateFormat: "DD/MM/YYYY", // Date format for display.
userName: "WebGL User", // Username to display in the author segment.
copyright: "Copyright © 2019 Uber. MIT Licensed" // Copyright string for the footer of the website and RSS feed.
};
106 changes: 106 additions & 0 deletions website/src/components/site-query.jsx
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} />;
}
}

0 comments on commit 48a3576

Please sign in to comment.