Files
SCM-Manager/scm-ui/ui-components/src/repos/Diff.tsx

33 lines
837 B
TypeScript
Raw Normal View History

import React from "react";
import DiffFile from "./DiffFile";
import { DiffObjectProps, File } from "./DiffTypes";
2019-11-20 13:40:40 +01:00
import Notification from "../Notification";
import { WithTranslation, withTranslation } from "react-i18next";
2019-11-20 13:40:40 +01:00
type Props = WithTranslation &
DiffObjectProps & {
diff: File[];
defaultCollapse?: boolean;
};
class Diff extends React.Component<Props> {
static defaultProps: Partial<Props> = {
sideBySide: false
};
2019-02-26 15:00:05 +01:00
render() {
2019-11-20 13:40:40 +01:00
const { diff, t, ...fileProps } = this.props;
return (
2019-02-26 15:00:05 +01:00
<>
2019-11-20 13:40:40 +01:00
{diff.length === 0 ? (
<Notification type="info">{t("noDiffFound")}</Notification>
) : (
diff.map((file, index) => <DiffFile key={index} file={file} {...fileProps} {...this.props} />)
)}
2019-02-26 15:00:05 +01:00
</>
);
}
}
2019-11-20 13:40:40 +01:00
export default withTranslation("plugins")(Diff);