File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
src/components/common/Diff Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useState } from 'react'
2
2
import styled from 'styled-components'
3
- import { Diff as RDiff , Hunk , markEdits , tokenize } from 'react-diff-view'
3
+ import {
4
+ Diff as RDiff ,
5
+ Hunk ,
6
+ markEdits ,
7
+ tokenize ,
8
+ Decoration as DiffDecoration
9
+ } from 'react-diff-view'
4
10
import DiffHeader from './DiffHeader'
5
11
import { getComments } from './DiffComment'
6
12
@@ -11,6 +17,17 @@ const Container = styled.div`
11
17
margin-top: 16px;
12
18
`
13
19
20
+ const More = styled . div `
21
+ background-color: #f1f8ff;
22
+ margin-left: 30px;
23
+ padding-left: 4px;
24
+ color: '#1b1f23b3';
25
+ `
26
+
27
+ const Decoration = styled ( DiffDecoration ) `
28
+ background-color: #dbedff;
29
+ `
30
+
14
31
const DiffView = styled ( RDiff ) `
15
32
.diff-gutter-col {
16
33
width: 30px;
@@ -122,14 +139,17 @@ const Diff = ({
122
139
123
140
const tokens = tokenize ( hunks , options )
124
141
125
- return hunks . map ( hunk => (
142
+ return hunks . map ( hunk => [
143
+ < Decoration key = { 'decoration-' + hunk . content } >
144
+ < More > { hunk . content } </ More >
145
+ </ Decoration > ,
126
146
< Hunk
127
147
key = { hunk . content }
128
148
hunk = { hunk }
129
149
tokens = { tokens }
130
150
gutterEvents = { { onClick : onToggleChangeSelection } }
131
151
/>
132
- ) )
152
+ ] )
133
153
} }
134
154
</ DiffView >
135
155
) }
You can’t perform that action at this time.
0 commit comments