Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/templates/components/Sidebar/Section.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Section extends React.Component {
onLinkClick,
onSectionTitleClick,
section,
sectionList,
} = this.props;
const uid = 'section_' + this.state.uid;
return (
Expand All @@ -48,17 +49,19 @@ class Section extends React.Component {
},
}}>
{section.title}
<ChevronSvg
cssProps={{
marginLeft: 7,
transform: isActive ? 'rotateX(180deg)' : 'rotateX(0deg)',
transition: 'transform 0.2s ease',
{sectionList.length > 1 && (
<ChevronSvg
cssProps={{
marginLeft: 7,
transform: isActive ? 'rotateX(180deg)' : 'rotateX(0deg)',
transition: 'transform 0.2s ease',

[media.lessThan('small')]: {
display: 'none',
},
}}
/>
[media.lessThan('small')]: {
display: 'none',
},
}}
/>
)}
</MetaTitle>
</button>
<ul
Expand Down Expand Up @@ -91,7 +94,7 @@ class Section extends React.Component {

{item.subitems && (
<ul css={{marginLeft: 20}}>
{item.subitems.map(subitem => (
{item.subitems.map((subitem) => (
<li key={subitem.id}>
{createLink({
isActive: isScrollSync
Expand Down
3 changes: 2 additions & 1 deletion src/templates/components/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ class Sidebar extends Component {
onLinkClick={closeParentMenu}
onSectionTitleClick={() => this._toggleSection(section)}
section={section}
sectionList={sectionList}
/>
))}
</Flex>
);
}

_toggleSection(section) {
this.setState(state => ({
this.setState((state) => ({
activeSection: state.activeSection === section ? null : section,
}));
}
Expand Down