extract empty stories tree check to seperate function

This commit is contained in:
Daniel Sneijers 2017-08-15 13:29:25 +02:00
parent 7addf9f69d
commit 4806e8b83c

View File

@ -25,6 +25,10 @@ const storyProps = [
'sidebarAnimations',
];
function hierarchyContainsStories(storiesHierarchy) {
return storiesHierarchy && storiesHierarchy.map.size
}
// eslint-disable-next-line react/prefer-stateless-function
class LeftPanel extends Component {
render() {
@ -46,7 +50,7 @@ class LeftPanel extends Component {
onChange={text => onStoryFilter(text)}
/>
<div style={scrollStyle}>
{storiesHierarchy && storiesHierarchy.map.size
{hierarchyContainsStories(storiesHierarchy)
? <Stories {...pick(this.props, storyProps)} />
: null}
</div>