-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathindex.js
85 lines (80 loc) · 1.96 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import React from 'react'
import DocumentTitle from 'react-document-title'
import { Link } from 'react-router'
import get from 'lodash/get'
import typography from '../blog-typography'
const rhythm = typography.rhythm
const profilePic = require('../images/kyle-round-small-pantheon.jpg')
class BlogIndexRoute extends React.Component {
render () {
const posts = this.props.data.allMarkdown.edges
const siteTitle = get(this.props, 'data.site.siteMetadata.title')
const pageLinks = posts.map((post) => {
if (post.node.frontmatter.draft !== true) {
return (
<li
key={post.node.path}
>
<Link
style={{
textDecoration: 'none',
}}
to={post.node.path}
>
{post.node.frontmatter.title}
</Link>
</li>
)
}
})
return (
<DocumentTitle title={siteTitle}>
<div>
<p
style={{
marginBottom: rhythm(2.5),
}}
>
<img
src={profilePic}
style={{
float: 'left',
marginRight: rhythm(1/4),
marginBottom: 0,
width: rhythm(2),
height: rhythm(2),
}}
/>
Written by <strong>{this.props.data.site.siteMetadata.author}</strong> who lives and works
in San Francisco building useful things. You should <a href="https://twitter.com/kylemathews">follow him on Twitter</a>
</p>
<ul>
{pageLinks}
</ul>
</div>
</DocumentTitle>
)
}
}
export default BlogIndexRoute
export const pageQuery = `
{
site {
siteMetadata {
title
author
}
}
allMarkdown(first: 2000) {
edges {
node {
path
frontmatter {
title
draft
}
}
}
}
}
`