Skip to content

Commit

Permalink
converting LeftPanel to a React.Component to resolve issue with React…
Browse files Browse the repository at this point in the history
… Fiber (storybookjs#1539)
  • Loading branch information
oriSomething committed Aug 3, 2017
1 parent a1986eb commit b5c65e6
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions lib/ui/src/modules/ui/components/left_panel/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import React, { Component } from 'react';
import pick from 'lodash.pick';
import Header from './header';
import Stories from './stories_tree';
Expand All @@ -23,18 +23,33 @@ const storyProps = [
'onSelectStory',
];

const LeftPanel = props =>
<div style={mainStyle}>
<Header name={props.name} url={props.url} openShortcutsHelp={props.openShortcutsHelp} />
<TextFilter
text={props.storyFilter}
onClear={() => props.onStoryFilter('')}
onChange={text => props.onStoryFilter(text)}
/>
<div style={scrollStyle}>
{props.storiesHierarchy ? <Stories {...pick(props, storyProps)} /> : null}
</div>
</div>;
// eslint-disable-next-line react/prefer-stateless-function
class LeftPanel extends Component {
render() {
const {
name,
onStoryFilter,
openShortcutsHelp,
storiesHierarchy,
storyFilter,
url,
} = this.props;

return (
<div style={mainStyle}>
<Header name={name} url={url} openShortcutsHelp={openShortcutsHelp} />
<TextFilter
text={storyFilter}
onClear={() => onStoryFilter('')}
onChange={text => onStoryFilter(text)}
/>
<div style={scrollStyle}>
{storiesHierarchy ? <Stories {...pick(this.props, storyProps)} /> : null}
</div>
</div>
);
}
}

LeftPanel.defaultProps = {
storiesHierarchy: null,
Expand Down

0 comments on commit b5c65e6

Please sign in to comment.