Version 1.0

This commit is contained in:
wpioneer 2016-06-03 14:05:50 +03:00
parent 05ee70daab
commit 4a4b34f52b
13 changed files with 39 additions and 35 deletions

View File

@ -2,8 +2,16 @@
Gatsby starter for creating a blog Gatsby starter for creating a blog
## Features
Inline CSS.
Clean and extensible code.
Six simple components: SiteSidebar, SiteNav, SiteLinks, SitePost, SitePage, ReadNext.
[peterramsing/lost](https://github.com/peterramsing/lost) as a base for Grid.
[matejlatin/Gutenberg](https://github.com/matejlatin/Gutenberg) as a base for Typography.
## Installing
Install this starter (assuming Gatsby is installed) by running from your CLI: Install this starter (assuming Gatsby is installed) by running from your CLI:
`gatsby new lumen https://github.com/hb-gatsby/gatsby-starter-lumen` `gatsby new lumen https://github.com/wpioneer/gatsby-starter-lumen`
## Running in development ## Running in development
`gatsby develop` `gatsby develop`

View File

@ -2,11 +2,10 @@ import React from 'react'
import { RouteHandler, Link } from 'react-router' import { RouteHandler, Link } from 'react-router'
import { prefixLink } from 'gatsby-helpers' import { prefixLink } from 'gatsby-helpers'
import { config } from 'config' import { config } from 'config'
import './style.css' import './style.css'
import '../../static/fonts/fontawesome/style.css' import '../../static/fonts/fontawesome/style.css'
class BlogSocial extends React.Component { class SiteLinks extends React.Component {
render() { render() {
return ( return (
@ -40,4 +39,4 @@ class BlogSocial extends React.Component {
} }
} }
export default BlogSocial export default SiteLinks

View File

@ -1,10 +1,9 @@
import React from 'react' import React from 'react'
import { RouteHandler, Link } from 'react-router' import { RouteHandler, Link } from 'react-router'
import { prefixLink } from 'gatsby-helpers' import { prefixLink } from 'gatsby-helpers'
import './style.css' import './style.css'
class BlogNav extends React.Component { class SiteNav extends React.Component {
render() { render() {
const {location} = this.props const {location} = this.props
return ( return (
@ -28,8 +27,8 @@ class BlogNav extends React.Component {
} }
} }
BlogNav.propTypes = { SiteNav.propTypes = {
location: React.PropTypes.object, location: React.PropTypes.object,
} }
export default BlogNav export default SiteNav

View File

@ -3,20 +3,19 @@ import moment from 'moment'
import { RouteHandler, Link } from 'react-router' import { RouteHandler, Link } from 'react-router'
import { prefixLink } from 'gatsby-helpers' import { prefixLink } from 'gatsby-helpers'
import DocumentTitle from 'react-document-title' import DocumentTitle from 'react-document-title'
import SidebarLeft from '../SidebarLeft'
import access from 'safe-access' import access from 'safe-access'
import { config } from 'config' import { config } from 'config'
import SiteSidebar from '../SiteSidebar'
import './style.css'; import './style.css';
class BlogPage extends React.Component { class SitePage extends React.Component {
render() { render() {
const {route} = this.props const {route} = this.props
const post = route.page.data const post = route.page.data
return ( return (
<div> <div>
<SidebarLeft {...this.props}/> <SiteSidebar {...this.props}/>
<div className='content'> <div className='content'>
<div className='main'> <div className='main'>
<div className='main-inner'> <div className='main-inner'>
@ -34,9 +33,9 @@ class BlogPage extends React.Component {
} }
} }
BlogPage.propTypes = { SitePage.propTypes = {
post: React.PropTypes.object.isRequired, post: React.PropTypes.object.isRequired,
pages: React.PropTypes.array, pages: React.PropTypes.array,
} }
export default BlogPage export default SitePage

View File

@ -9,7 +9,7 @@ import ReadNext from '../ReadNext'
import './style.css' import './style.css'
import '../../static/css/highlight.css' import '../../static/css/highlight.css'
class BlogPost extends React.Component { class SitePost extends React.Component {
render() { render() {
const {route} = this.props const {route} = this.props
const post = route.page.data const post = route.page.data
@ -46,9 +46,9 @@ class BlogPost extends React.Component {
} }
} }
BlogPost.propTypes = { SitePost.propTypes = {
post: React.PropTypes.object.isRequired, post: React.PropTypes.object.isRequired,
pages: React.PropTypes.array, pages: React.PropTypes.array,
} }
export default BlogPost export default SitePost

View File

@ -2,11 +2,11 @@ import React from 'react'
import { RouteHandler, Link } from 'react-router' import { RouteHandler, Link } from 'react-router'
import { prefixLink } from 'gatsby-helpers' import { prefixLink } from 'gatsby-helpers'
import { config } from 'config' import { config } from 'config'
import BlogNav from '../BlogNav' import SiteNav from '../SiteNav'
import BlogSocial from '../BlogSocial' import SiteLinks from '../SiteLinks'
import './style.css' import './style.css'
class SidebarLeft extends React.Component { class SiteSidebar extends React.Component {
render() { render() {
const {location, children} = this.props const {location, children} = this.props
const isHome = location.pathname === prefixLink('/') const isHome = location.pathname === prefixLink('/')
@ -35,9 +35,9 @@ class SidebarLeft extends React.Component {
</header> </header>
</div> </div>
<div className='blog-options'> <div className='blog-options'>
<BlogNav {...this.props}/> <SiteNav {...this.props}/>
<footer> <footer>
<BlogSocial {...this.props}/> <SiteLinks {...this.props}/>
<p className='copyright'> <p className='copyright'>
&copy; All rights reserved. &copy; All rights reserved.
</p> </p>
@ -49,9 +49,9 @@ class SidebarLeft extends React.Component {
} }
} }
SidebarLeft.propTypes = { SiteSidebar.propTypes = {
children: React.PropTypes.any, children: React.PropTypes.any,
location: React.PropTypes.object, location: React.PropTypes.object,
} }
export default SidebarLeft export default SiteSidebar

View File

@ -6,11 +6,10 @@ import DocumentTitle from 'react-document-title'
import { prefixLink } from 'gatsby-helpers' import { prefixLink } from 'gatsby-helpers'
import access from 'safe-access' import access from 'safe-access'
import { config } from 'config' import { config } from 'config'
import SitePost from '../components/SitePost'
import SiteSidebar from '../components/SiteSidebar'
import BlogPost from '../components/BlogPost' class SiteIndex extends React.Component {
import SidebarLeft from '../components/SidebarLeft'
class BlogIndex extends React.Component {
render() { render() {
const pageLinks = [] const pageLinks = []
// Sort pages. // Sort pages.
@ -42,7 +41,7 @@ class BlogIndex extends React.Component {
return ( return (
<DocumentTitle title={ config.siteTitle }> <DocumentTitle title={ config.siteTitle }>
<div> <div>
<SidebarLeft {...this.props}/> <SiteSidebar {...this.props}/>
<div className='content'> <div className='content'>
<div className='main'> <div className='main'>
<div className='main-inner'> <div className='main-inner'>
@ -56,8 +55,8 @@ class BlogIndex extends React.Component {
} }
} }
BlogIndex.propTypes = { SiteIndex.propTypes = {
route: React.PropTypes.object, route: React.PropTypes.object,
} }
export default BlogIndex export default SiteIndex

View File

@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import DocumentTitle from 'react-document-title' import DocumentTitle from 'react-document-title'
import BlogPost from '../components/BlogPost' import SitePost from '../components/SitePost'
import BlogPage from '../components/BlogPage' import SitePage from '../components/SitePage'
import { config } from 'config' import { config } from 'config'
class MarkdownWrapper extends React.Component { class MarkdownWrapper extends React.Component {
@ -13,9 +13,9 @@ class MarkdownWrapper extends React.Component {
layout = post.layout layout = post.layout
if (layout != 'page') { if (layout != 'page') {
template = <BlogPost {...this.props}/> template = <SitePost {...this.props}/>
} else { } else {
template = <BlogPage {...this.props}/> template = <SitePage {...this.props}/>
} }
return ( return (