Skip to content

Commit 9f44215

Browse files
committed
refactor(tsx): convert Diff to tsx
1 parent e6f3a4e commit 9f44215

File tree

4 files changed

+59
-12
lines changed

4 files changed

+59
-12
lines changed

package-lock.json

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"@types/lodash": "^4.17.15",
9393
"@types/mocha": "^10.0.10",
9494
"@types/node": "^22.13.5",
95+
"@types/react-html-parser": "^2.0.7",
9596
"@types/react-dom": "^17.0.11",
9697
"@types/yargs": "^17.0.33",
9798
"@typescript-eslint/eslint-plugin": "^8.29.0",

src/ui/views/PushDetails/components/Diff.jsx

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as Diff2Html from 'diff2html';
2+
import reactHtmlParser from 'react-html-parser'; // Renamed to follow function naming conventions
3+
import React from 'react';
4+
5+
interface DiffProps {
6+
diff: string;
7+
}
8+
9+
const Diff: React.FC<DiffProps> = ({ diff }) => {
10+
const outputHtml = Diff2Html.html(diff, {
11+
drawFileList: true,
12+
matching: 'lines',
13+
outputFormat: 'side-by-side',
14+
});
15+
16+
return <>{reactHtmlParser(outputHtml)}</>;
17+
};
18+
19+
export default Diff;

0 commit comments

Comments
 (0)