From 15fc32561f9128fa9f7ba7179249d307d2d21c3e Mon Sep 17 00:00:00 2001 From: jxom Date: Sun, 8 Oct 2017 11:34:24 +1100 Subject: [PATCH] Run check-all script --- src/components/MarkdownPage/MarkdownPage.js | 10 ++-- .../components/Sidebar/ScrollSyncSection.js | 47 +++++++++---------- src/templates/components/Sidebar/Section.js | 14 ++++-- src/templates/components/Sidebar/Sidebar.js | 12 +++-- src/templates/tutorial.js | 2 +- src/utils/createLink.js | 2 +- src/utils/isItemActive.js | 2 +- 7 files changed, 47 insertions(+), 42 deletions(-) diff --git a/src/components/MarkdownPage/MarkdownPage.js b/src/components/MarkdownPage/MarkdownPage.js index f4bc96ef..737a84d1 100644 --- a/src/components/MarkdownPage/MarkdownPage.js +++ b/src/components/MarkdownPage/MarkdownPage.js @@ -25,8 +25,8 @@ import createOgUrl from 'utils/createOgUrl'; const MarkdownPage = ({ authors, createLink, - date, - enableScrollSync, + date, + enableScrollSync, ogDescription, location, markdownRemark, @@ -99,7 +99,7 @@ const MarkdownPage = ({
= itemTopOffset.offsetTop; - }); + }); this.setState({ activeItemId: item ? item.id : '', }); @@ -71,12 +71,7 @@ class ScrollSyncSection extends Component { render() { const {activeItemId} = this.state; - return ( -
- ); + return
; } } @@ -103,6 +98,6 @@ const _getElementTopOffsetsById = ids => offsetTop: element.offsetTop, }; }) - .filter(item => item); + .filter(item => item); export default ScrollSyncSection; diff --git a/src/templates/components/Sidebar/Section.js b/src/templates/components/Sidebar/Section.js index 99215c66..4630ccda 100644 --- a/src/templates/components/Sidebar/Section.js +++ b/src/templates/components/Sidebar/Section.js @@ -15,10 +15,10 @@ import MetaTitle from '../MetaTitle'; import ChevronSvg from '../ChevronSvg'; const Section = ({ - activeItemId, + activeItemId, createLink, - isActive, - isScrollSync, + isActive, + isScrollSync, location, onLinkClick, onSectionTitleClick, @@ -66,7 +66,9 @@ const Section = ({ marginTop: 5, }}> {createLink({ - isActive: isScrollSync ? activeItemId === item.id : isItemActive(location, item), + isActive: isScrollSync + ? activeItemId === item.id + : isItemActive(location, item), item, location, onLinkClick, @@ -78,7 +80,9 @@ const Section = ({ {item.subitems.map(subitem => (
  • {createLink({ - isActive: isScrollSync ? activeItemId === subitem.id : isItemActive(location, subitem), + isActive: isScrollSync + ? activeItemId === subitem.id + : isItemActive(location, subitem), item: subitem, location, onLinkClick, diff --git a/src/templates/components/Sidebar/Sidebar.js b/src/templates/components/Sidebar/Sidebar.js index 5765a4c8..770781ff 100644 --- a/src/templates/components/Sidebar/Sidebar.js +++ b/src/templates/components/Sidebar/Sidebar.js @@ -25,10 +25,16 @@ class Sidebar extends Component { } render() { - const {closeParentMenu, createLink, enableScrollSync, location, sectionList} = this.props; - const {activeSection} = this.state; + const { + closeParentMenu, + createLink, + enableScrollSync, + location, + sectionList, + } = this.props; + const {activeSection} = this.state; - const SectionComponent = enableScrollSync ? ScrollSyncSection : Section; + const SectionComponent = enableScrollSync ? ScrollSyncSection : Section; return ( { return ( { ); } return createLinkDocs({ - isActive, + isActive, item, section, }); diff --git a/src/utils/isItemActive.js b/src/utils/isItemActive.js index ba69c090..076b50aa 100644 --- a/src/utils/isItemActive.js +++ b/src/utils/isItemActive.js @@ -20,7 +20,7 @@ const toAnchor = (href = '') => { // This comment should not be true anymore since we're using 300 redirects const isItemActive = (location, item) => { - if (location.hash) { + if (location.hash) { if (item.href) { return location.hash === toAnchor(item.href); }