mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-08-08 10:27:56 +02:00
🔖 Upgrade to Gatsby 1.8.12
This commit is contained in:
74
src/components/Sidebar/index.jsx
Normal file
74
src/components/Sidebar/index.jsx
Normal file
@@ -0,0 +1,74 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import get from 'lodash/get';
|
||||
import Link from 'gatsby-link';
|
||||
import Menu from '../Menu';
|
||||
import Links from '../Links';
|
||||
import profilePic from '../../pages/photo.jpg';
|
||||
import './style.scss';
|
||||
|
||||
class Sidebar extends React.Component {
|
||||
render() {
|
||||
const { location } = this.props;
|
||||
const { author, subtitle, copyright, menu } = this.props.data.site.siteMetadata;
|
||||
const isHomePage = get(location, 'pathname', '/') === '/';
|
||||
|
||||
/* eslint-disable jsx-a11y/img-redundant-alt*/
|
||||
const authorBlock = (
|
||||
<div>
|
||||
<Link to="/">
|
||||
<img
|
||||
src={profilePic}
|
||||
className="sidebar__author-photo"
|
||||
width="75" height="75"
|
||||
alt={author.name}
|
||||
/>
|
||||
</Link>
|
||||
{ isHomePage ? (
|
||||
<h1 className="sidebar__author-title">
|
||||
<Link className="sidebar__author-title-link" to="/">{author.name}</Link>
|
||||
</h1>
|
||||
) :
|
||||
<h2 className="sidebar__author-title">
|
||||
<Link className="sidebar__author-title-link" to="/">{author.name}</Link>
|
||||
</h2>
|
||||
}
|
||||
<p className="sidebar__author-subtitle">{subtitle}</p>
|
||||
</div>
|
||||
);
|
||||
/* eslint-enable jsx-a11y/img-redundant-alt*/
|
||||
|
||||
return (
|
||||
<div className="sidebar">
|
||||
<div className="sidebar__inner">
|
||||
<div className="sidebar__author">
|
||||
{authorBlock}
|
||||
</div>
|
||||
<div>
|
||||
<Menu data={menu} />
|
||||
<Links data={author} />
|
||||
<p className="sidebar__copyright">
|
||||
{copyright}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Sidebar.propTypes = {
|
||||
data: PropTypes.shape({
|
||||
site: PropTypes.shape({
|
||||
siteMetadata: PropTypes.shape({
|
||||
subtitle: PropTypes.string.isRequired,
|
||||
author: PropTypes.object.isRequired,
|
||||
copyright: PropTypes.string.isRequired,
|
||||
menu: PropTypes.array.isRequired
|
||||
})
|
||||
})
|
||||
}),
|
||||
location: PropTypes.object
|
||||
};
|
||||
|
||||
export default Sidebar;
|
Reference in New Issue
Block a user