refactor: fixes linting errors components/SiteSidebar/index.jsx

This commit is contained in:
Simon Reinsperger 2017-03-08 17:53:24 +01:00
parent 923a226d9d
commit 9ace1405f8

View File

@ -1,58 +1,63 @@
import React from 'react' import React from 'react';
import { RouteHandler, Link } from 'react-router' import { Link } from 'react-router';
import { prefixLink } from 'gatsby-helpers' import { prefixLink } from 'gatsby-helpers';
import { config } from 'config' import { config } from 'config';
import SiteNav from '../SiteNav' import SiteNav from '../SiteNav';
import SiteLinks from '../SiteLinks' import SiteLinks from '../SiteLinks';
import './style.css' import './style.css';
import profilePic from '../../pages/photo.jpg' import profilePic from '../../pages/photo.jpg';
class SiteSidebar extends React.Component { class SiteSidebar extends React.Component {
render() { render() {
const {location, children} = this.props const { location } = this.props;
const isHome = location.pathname === prefixLink('/') const isHome = location.pathname === prefixLink('/');
let header = ( /* eslint-disable jsx-a11y/img-redundant-alt*/
<header> const header = (
<Link style={ { textDecoration: 'none', borderBottom: 'none', outline: 'none'} } to={ prefixLink('/') }> <header>
<img src={prefixLink(profilePic)} width='75' height='75' /> <Link style={{ textDecoration: 'none', borderBottom: 'none', outline: 'none' }} to={prefixLink('/')}>
</Link> <img
{ isHome ? ( src={prefixLink(profilePic)}
<h1><Link style={ { textDecoration: 'none', borderBottom: 'none', color: 'inherit'} } to={ prefixLink('/') }> { config.siteAuthor } </Link></h1> width="75" height="75"
) : alt="Profile picture of the author"
<h2><Link style={ { textDecoration: 'none', borderBottom: 'none', color: 'inherit'} } to={ prefixLink('/') }> { config.siteAuthor } </Link></h2> } />
<p> </Link>
{ config.siteDescr } { isHome ? (
</p> <h1><Link style={{ textDecoration: 'none', borderBottom: 'none', color: 'inherit' }} to={prefixLink('/')}> {config.siteAuthor}</Link></h1>
</header> ) :
) <h2><Link style={{ textDecoration: 'none', borderBottom: 'none', color: 'inherit' }} to={prefixLink('/')}> {config.siteAuthor}</Link></h2> }
<p>
{config.siteDescr}
</p>
</header>
);
/* eslint-enable jsx-a11y/img-redundant-alt*/
return ( return (
<div className='sidebar'> <div className="sidebar">
<div className='sidebar-inner'> <div className="sidebar-inner">
<div className='blog-details'> <div className="blog-details">
<header> <header>
{ header } {header}
</header> </header>
</div> </div>
<div className='blog-options'> <div className="blog-options">
<SiteNav {...this.props}/> <SiteNav {...this.props} />
<footer> <footer>
<SiteLinks {...this.props}/> <SiteLinks {...this.props} />
<p className='copyright'> <p className="copyright">
&copy; All rights reserved. &copy; All rights reserved.
</p> </p>
</footer> </footer>
</div> </div>
</div> </div>
</div> </div>
); );
} }
} }
SiteSidebar.propTypes = { SiteSidebar.propTypes = {
children: React.PropTypes.any, location: React.PropTypes.object,
location: React.PropTypes.object, };
}
export default SiteSidebar export default SiteSidebar;