2019-10-19 16:38:07 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
import DiffFile from './DiffFile';
|
|
|
|
|
import { DiffObjectProps, File } from './DiffTypes';
|
2018-12-11 13:25:35 +01:00
|
|
|
|
2019-02-27 11:56:50 +01:00
|
|
|
type Props = DiffObjectProps & {
|
2019-10-19 16:38:07 +02:00
|
|
|
diff: File[];
|
|
|
|
|
defaultCollapse?: boolean;
|
2018-12-11 13:25:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Diff extends React.Component<Props> {
|
|
|
|
|
static defaultProps = {
|
2019-10-19 16:38:07 +02:00
|
|
|
sideBySide: false,
|
2018-12-11 13:25:35 +01:00
|
|
|
};
|
|
|
|
|
|
2019-02-26 15:00:05 +01:00
|
|
|
render() {
|
2019-02-27 11:56:50 +01:00
|
|
|
const { diff, ...fileProps } = this.props;
|
2018-12-11 13:25:35 +01:00
|
|
|
return (
|
2019-02-26 15:00:05 +01:00
|
|
|
<>
|
2019-02-27 11:56:50 +01:00
|
|
|
{diff.map((file, index) => (
|
2019-09-30 16:45:56 +02:00
|
|
|
<DiffFile key={index} file={file} {...fileProps} {...this.props} />
|
2019-02-27 11:56:50 +01:00
|
|
|
))}
|
2019-02-26 15:00:05 +01:00
|
|
|
</>
|
2018-12-11 13:25:35 +01:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Diff;
|