Refactor duplicate GraphQL to Fragment, eliminate all the spread syntax

This commit is contained in:
Yanda Huang
2018-05-06 15:32:25 -04:00
parent 2a6e053ab9
commit 1dd12522e5
14 changed files with 62 additions and 144 deletions

View File

@@ -9,7 +9,7 @@ import './style.scss';
class Sidebar extends React.Component {
render() {
const { location } = this.props;
const { author, subtitle, copyright, menu } = this.props.data.site.siteMetadata;
const { author, subtitle, copyright, menu } = this.props.siteMetadata;
const isHomePage = get(location, 'pathname', '/') === '/';
/* eslint-disable jsx-a11y/img-redundant-alt */
@@ -58,3 +58,24 @@ class Sidebar extends React.Component {
}
export default Sidebar;
export const conponentQuery = graphql`
fragment sidebarFragment on siteMetadata_2{
title
subtitle
copyright
menu {
label
path
}
author {
name
email
telegram
twitter
github
rss
vk
}
}
`;