Skip to content

Commit

Permalink
update text diffrence
Browse files Browse the repository at this point in the history
  • Loading branch information
ashik-75 committed Sep 28, 2023
1 parent fd46ca9 commit c4737e2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 40 deletions.
4 changes: 0 additions & 4 deletions ui/src/pages/Tools/Diffchecker/Diffchecker.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@
justify-content: center;
padding: var(--bt-size-20) 0;
}

&_output {
overflow: auto;
}
}
70 changes: 34 additions & 36 deletions ui/src/pages/Tools/Diffchecker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,47 +56,45 @@ const Diffchecker: React.FC = () => {
<PageGrid>
{lineDifferences.length > 0 && (
<Card title="Original text output ">
<div className={style.diffchecker_output}>
<pre>
{lineDifferences
.filter((part) => !part.added)
.map((part, index) => (
<span
key={index}
style={{
backgroundColor: part.removed
? "salmon"
: "white",
}}
>
{part.value}
</span>
))}
</pre>
</div>
<pre>
{lineDifferences
.filter((part) => !part.added)
.map((part, index) => (
<span
key={index}
style={{
backgroundColor: part.removed
? "salmon"
: "white",
whiteSpace: "pre-wrap",
}}
>
{part.value}
</span>
))}
</pre>
</Card>
)}

{lineDifferences.length > 0 && (
<Card title="Change text output">
<div className={style.diffchecker_output}>
<pre lang={"js"}>
{lineDifferences
.filter((part) => !part.removed)
.map((part, index) => (
<span
key={index}
style={{
backgroundColor: part.added
? "lightgreen"
: "white",
}}
>
{part.value}
</span>
))}
</pre>
</div>
<pre>
{lineDifferences
.filter((part) => !part.removed)
.map((part, index) => (
<span
key={index}
style={{
backgroundColor: part.added
? "lightgreen"
: "white",
whiteSpace: "pre-wrap",
}}
>
{part.value}
</span>
))}
</pre>
</Card>
)}
</PageGrid>
Expand Down

0 comments on commit c4737e2

Please sign in to comment.