pass function to toggle collpase state to FileControlFactory

This commit is contained in:
Sebastian Sdorra
2019-03-08 08:27:20 +01:00
parent 57454f9aa9
commit b9b544b7f0
2 changed files with 8 additions and 2 deletions

View File

@@ -56,6 +56,12 @@ class DiffFile extends React.Component<Props, State> {
}));
};
setCollapse = (collapsed: boolean) => {
this.setState({
collapsed
});
};
createHunkHeader = (hunk: Hunk, i: number) => {
const { classes } = this.props;
if (i > 0) {
@@ -166,7 +172,7 @@ class DiffFile extends React.Component<Props, State> {
);
}
const fileControls = fileControlFactory ? fileControlFactory(file) : null;
const fileControls = fileControlFactory ? fileControlFactory(file, this.setCollapse) : null;
return (
<div className={classNames("panel", classes.panel)}>
<div className="panel-heading">