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 Jul 31, 2017
1 parent b2ee1c1 commit 1a61b77
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 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,25 @@ 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>;
class LeftPanel extends Component {
render() {
const { props } = this;

return (
<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>
);
}
}

LeftPanel.defaultProps = {
storiesHierarchy: null,
Expand Down

0 comments on commit 1a61b77

Please sign in to comment.