Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 242ed2e

Browse files
committed
bring back line number background
1 parent 6b0b3a8 commit 242ed2e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/client/app/modules/components/code-view.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ export const LineNumbers = ({start, length, lno}) => {
2222
)
2323
}
2424

25+
export const LineNumbersBackground = ({start, length, lno}) => {
26+
start = Math.max(start, 1)
27+
return (
28+
<div className="LineNumbersBackgroundContainer">
29+
{_.range(start, start+length).map((number) => {
30+
var classes = classnames('LineNumber', {
31+
'LineNumber--focused': lno == number
32+
});
33+
return <div key={number} className={classes}>&nbsp;</div>
34+
})}
35+
</div>
36+
)
37+
}
38+
2539
function loadingString(filePath) {
2640
return 'Loading ...';
2741
}
@@ -143,6 +157,7 @@ export class CodeView extends React.Component {
143157
}
144158
<pre className="Snippet-code">
145159
{length? <LineNumbers start={start} length={length} lno={lno}/> : null}
160+
{length? <LineNumbersBackground start={start} length={length} lno={lno}/> : null}
146161
<SuperFuckingAwesomeHorizontalScrollbars>
147162
<CodeInnerView
148163
key={filePath}

src/client/sass/partials/_code.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@
4848
z-index: 100;
4949
color: #999;
5050
background: #2b303b;
51+
box-sizing: border-box;
52+
}
53+
54+
.LineNumbersBackgroundContainer {
55+
position: absolute;
56+
width: 100%;
57+
font-family: 'Inconsolata', monospace;
58+
margin: 16px 0;
59+
padding: 0;
60+
color: #999;
5161
text-align: right;
5262
padding-right: 10px;
5363
box-sizing: border-box;

0 commit comments

Comments
 (0)