New site setup
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import React from 'react';
|
||||
import injectSheet from 'react-jss';
|
||||
import {object, func} from 'prop-types';
|
||||
import Link from 'gatsby-link';
|
||||
|
||||
const Layout = ({classes, children}) => (
|
||||
<div className={classes.layout}>
|
||||
<header className={classes.header}>
|
||||
<h1>
|
||||
<Link to="/">OpenLayers</Link>
|
||||
</h1>
|
||||
<div>
|
||||
<Link to="/examples/">examples</Link>
|
||||
</div>
|
||||
</header>
|
||||
<main className={classes.main}>{children()}</main>
|
||||
</div>
|
||||
);
|
||||
|
||||
Layout.propTypes = {
|
||||
children: func.isRequired,
|
||||
classes: object.isRequired
|
||||
};
|
||||
|
||||
const styles = {
|
||||
layout: {
|
||||
margin: '1em auto',
|
||||
maxWidth: '960px'
|
||||
},
|
||||
header: {
|
||||
display: 'flex',
|
||||
alignItems: 'baseline',
|
||||
padding: '0 2em',
|
||||
marginBottom: '2em',
|
||||
'& h1': {
|
||||
margin: '0 auto 0 0'
|
||||
}
|
||||
},
|
||||
main: {
|
||||
padding: '0 2em'
|
||||
}
|
||||
};
|
||||
|
||||
export default injectSheet(styles)(Layout);
|
||||
@@ -0,0 +1,42 @@
|
||||
import React, {Component} from 'react';
|
||||
import {object} from 'prop-types';
|
||||
import Link from 'gatsby-link';
|
||||
|
||||
class Examples extends Component {
|
||||
renderExample({node}) {
|
||||
const context = node.context;
|
||||
return (
|
||||
<li key={node.id}>
|
||||
<Link to={context.slug}>{context.frontmatter.title}</Link>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return <ul>{this.props.data.allSitePage.edges.map(this.renderExample)}</ul>;
|
||||
}
|
||||
}
|
||||
|
||||
Examples.propTypes = {
|
||||
data: object.isRequired
|
||||
};
|
||||
|
||||
export const query = graphql`
|
||||
query ExampleList {
|
||||
allSitePage(filter: {pluginCreator: {name: {eq: "examples"}}}) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
context {
|
||||
slug
|
||||
frontmatter {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export default Examples;
|
||||
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
|
||||
export default () => <p>This is the home page</p>;
|
||||
@@ -0,0 +1,14 @@
|
||||
const Typography = require('typography');
|
||||
const theme = require('typography-theme-noriega').default;
|
||||
const CodePlugin = require('typography-plugin-code').default;
|
||||
|
||||
theme.plugins = [new CodePlugin()];
|
||||
|
||||
theme.overrideThemeStyles = () => ({
|
||||
a: {
|
||||
color: '#003c88',
|
||||
textDecoration: 'none'
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = new Typography(theme);
|
||||
Reference in New Issue
Block a user