rickvanlieshout.com/src/components/Sidebar/Sidebar.js

72 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-04-08 17:53:56 +02:00
// @flow
2018-11-09 18:08:48 +01:00
import React from 'react';
import { graphql, StaticQuery } from 'gatsby';
import Author from './Author';
import Contacts from './Contacts';
import Copyright from './Copyright';
import Menu from './Menu';
import styles from './Sidebar.module.scss';
2019-04-08 17:53:56 +02:00
type Props = {
+isIndex: ?boolean,
};
type PureProps = Props & {
+data: Object,
};
export const PureSidebar = ({ data, isIndex }: PureProps) => {
2018-11-09 18:08:48 +01:00
const {
author,
copyright,
menu
} = data.site.siteMetadata;
return (
<div className={styles['sidebar']}>
<div className={styles['sidebar__inner']}>
<Author author={author} isIndex={isIndex} />
<Menu menu={menu} />
<Contacts contacts={author.contacts} />
<Copyright copyright={copyright} />
</div>
</div>
);
};
2019-04-08 17:53:56 +02:00
export const Sidebar = (props: Props) => (
2018-11-09 18:08:48 +01:00
<StaticQuery
query={graphql`
query SidebarQuery {
site {
siteMetadata {
title
subtitle
copyright
menu {
label
path
}
author {
name
2018-11-09 20:20:44 +01:00
photo
2018-11-09 18:08:48 +01:00
bio
2019-04-08 17:53:56 +02:00
contacts {
2018-11-09 18:08:48 +01:00
twitter
telegram
github
email
rss
vkontakte
}
}
}
}
}
`}
render={(data) => <PureSidebar {...props} data={data}/>}
/>
);
export default Sidebar;