Browse Source

Run check-all script

main
jxom 7 years ago
parent
commit
15fc32561f
  1. 7
      src/templates/components/Sidebar/ScrollSyncSection.js
  2. 8
      src/templates/components/Sidebar/Section.js
  3. 8
      src/templates/components/Sidebar/Sidebar.js

7
src/templates/components/Sidebar/ScrollSyncSection.js

@ -71,12 +71,7 @@ class ScrollSyncSection extends Component {
render() { render() {
const {activeItemId} = this.state; const {activeItemId} = this.state;
return ( return <Section isScrollSync activeItemId={activeItemId} {...this.props} />;
<Section
isScrollSync
activeItemId={activeItemId} {...this.props}
/>
);
} }
} }

8
src/templates/components/Sidebar/Section.js

@ -66,7 +66,9 @@ const Section = ({
marginTop: 5, marginTop: 5,
}}> }}>
{createLink({ {createLink({
isActive: isScrollSync ? activeItemId === item.id : isItemActive(location, item), isActive: isScrollSync
? activeItemId === item.id
: isItemActive(location, item),
item, item,
location, location,
onLinkClick, onLinkClick,
@ -78,7 +80,9 @@ const Section = ({
{item.subitems.map(subitem => ( {item.subitems.map(subitem => (
<li key={subitem.id}> <li key={subitem.id}>
{createLink({ {createLink({
isActive: isScrollSync ? activeItemId === subitem.id : isItemActive(location, subitem), isActive: isScrollSync
? activeItemId === subitem.id
: isItemActive(location, subitem),
item: subitem, item: subitem,
location, location,
onLinkClick, onLinkClick,

8
src/templates/components/Sidebar/Sidebar.js

@ -25,7 +25,13 @@ class Sidebar extends Component {
} }
render() { render() {
const {closeParentMenu, createLink, enableScrollSync, location, sectionList} = this.props; const {
closeParentMenu,
createLink,
enableScrollSync,
location,
sectionList,
} = this.props;
const {activeSection} = this.state; const {activeSection} = this.state;
const SectionComponent = enableScrollSync ? ScrollSyncSection : Section; const SectionComponent = enableScrollSync ? ScrollSyncSection : Section;

Loading…
Cancel
Save