Skip to content

Commit c695108

Browse files
committed
fix: adding background to full modified lines
1 parent c62c351 commit c695108

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

pages/diff/_diff.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,27 @@
5656
class="relative flex-1 px-4 py-2 overflow-y-auto border-2 rounded-md dark:border-gray-500 max-h-screen--nav line-number-gutter min-h-80"
5757
>
5858
<RTStickyCopyButton :clickHandler="copyTextToClipboard" />
59-
<div v-for="(lineDiff, index) in lhsDiff" :key="index">
59+
<div
60+
v-for="(lineDiff, index) in lhsDiff"
61+
:key="index"
62+
v-bind:class="{
63+
'bg-red-100 dark:bg-yellow-700': lineDiff.includes('isModified'),
64+
}"
65+
>
6066
<p class="break-all whitespace-pre-wrap" v-html="lineDiff"></p>
6167
</div>
6268
</div>
6369
<div
6470
class="relative flex-1 px-4 py-2 overflow-y-auto border-2 rounded-md dark:border-gray-500 min-h-80 line-number-gutter max-h-screen--nav"
6571
>
6672
<RTStickyCopyButton :clickHandler="copyTextToClipboard" />
67-
<div v-for="(lineDiff, index) in rhsDiff" :key="index">
73+
<div
74+
v-for="(lineDiff, index) in rhsDiff"
75+
:key="index"
76+
v-bind:class="{
77+
'bg-green-100 dark:bg-green-700': lineDiff.includes('isModified'),
78+
}"
79+
>
6880
<p class="break-all whitespace-pre-wrap" v-html="lineDiff"></p>
6981
</div>
7082
</div>
@@ -87,7 +99,7 @@ export default {
8799
const hunkState = item[0]
88100
if (hunkState === -1 || hunkState === 0) {
89101
const className =
90-
hunkState === -1 ? 'bg-red-300 dark:bg-yellow-800' : ''
102+
hunkState === -1 ? 'isModified bg-red-300 dark:bg-yellow-900' : ''
91103
return `<span class="break-all inline p-0 m-0 ${className}">${item[1]}</span>`
92104
}
93105
return false
@@ -100,7 +112,7 @@ export default {
100112
const hunkState = item[0]
101113
if (hunkState === 1 || hunkState === 0) {
102114
const className =
103-
hunkState === 1 ? 'bg-green-300 dark:bg-green-800' : ''
115+
hunkState === 1 ? 'isModified bg-green-300 dark:bg-green-900' : ''
104116
return `<span class="break-all inline p-0 m-0 ${className}">${item[1]}</span>`
105117
}
106118
return false

0 commit comments

Comments
 (0)