rickvanlieshout.com/components/SiteSidebar/index.jsx

58 lines
1.9 KiB
React
Raw Normal View History

2016-03-11 23:28:19 +01:00
import React from 'react'
import { RouteHandler, Link } from 'react-router'
2016-06-03 01:32:38 +02:00
import { prefixLink } from 'gatsby-helpers'
2016-03-11 23:28:19 +01:00
import { config } from 'config'
2016-06-03 13:05:50 +02:00
import SiteNav from '../SiteNav'
import SiteLinks from '../SiteLinks'
2016-06-03 01:32:38 +02:00
import './style.css'
2016-07-30 01:05:32 +02:00
import profilePic from '../../pages/photo.jpg'
2016-03-11 23:28:19 +01:00
2016-06-03 13:05:50 +02:00
class SiteSidebar extends React.Component {
2016-03-21 18:03:01 +01:00
render() {
const {location, children} = this.props
2016-06-03 01:32:38 +02:00
const isHome = location.pathname === prefixLink('/')
2016-03-11 23:28:19 +01:00
2016-06-03 01:32:38 +02:00
let header = (
<header>
<Link style={ { textDecoration: 'none', borderBottom: 'none', outline: 'none'} } to={ prefixLink('/') }>
2016-07-30 01:05:32 +02:00
<img src={prefixLink(profilePic)} width='75' height='75' />
2016-06-03 01:32:38 +02:00
</Link>
{ isHome ? (
<h1><Link style={ { textDecoration: 'none', borderBottom: 'none', color: 'inherit'} } to={ prefixLink('/') }> { config.siteAuthor } </Link></h1>
) :
<h2><Link style={ { textDecoration: 'none', borderBottom: 'none', color: 'inherit'} } to={ prefixLink('/') }> { config.siteAuthor } </Link></h2> }
<p>
{ config.siteDescr }
</p>
</header>
)
2016-03-21 18:03:01 +01:00
return (
<div className='sidebar'>
<div className='sidebar-inner'>
<div className='blog-details'>
<header>
{ header }
</header>
</div>
<div className='blog-options'>
2016-06-03 13:05:50 +02:00
<SiteNav {...this.props}/>
2016-03-21 18:03:01 +01:00
<footer>
2016-06-03 13:05:50 +02:00
<SiteLinks {...this.props}/>
2016-03-21 18:03:01 +01:00
<p className='copyright'>
&copy; All rights reserved.
</p>
</footer>
</div>
</div>
</div>
);
}
2016-03-11 23:28:19 +01:00
}
2016-06-03 13:05:50 +02:00
SiteSidebar.propTypes = {
2016-03-21 18:03:01 +01:00
children: React.PropTypes.any,
location: React.PropTypes.object,
2016-03-11 23:28:19 +01:00
}
2016-06-03 13:05:50 +02:00
export default SiteSidebar