File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ const ansiToJSON = require('ansi-to-json');
4
4
5
5
function ansiJSONtoStyleBundle ( ansiBundle ) {
6
6
const style = { } ;
7
- if ( ansiBundle . bg ) {
7
+ if ( ansiBundle . bg ) {
8
8
style . backgroundColor = `rgb(${ ansiBundle . bg } )` ;
9
9
}
10
- if ( ansiBundle . fg ) {
10
+ if ( ansiBundle . fg ) {
11
11
style . color = `rgb(${ ansiBundle . fg } )` ;
12
12
}
13
13
return {
@@ -17,11 +17,13 @@ function ansiJSONtoStyleBundle(ansiBundle) {
17
17
}
18
18
19
19
function ansiToInlineStyle ( text ) {
20
- return ansiToJSON ( text ) . map ( ansiJSONtoStyleBundle )
20
+ return ansiToJSON ( text ) . map ( ansiJSONtoStyleBundle ) ;
21
21
}
22
22
23
23
function inlineBundleToReact ( bundle , key ) {
24
- return < span style = { bundle . style } key = { key } > { bundle . content } </ span >
24
+ return (
25
+ < span style = { bundle . style } key = { key } > { bundle . content } </ span >
26
+ ) ;
25
27
}
26
28
27
29
export default function Ansi ( props ) {
@@ -30,6 +32,9 @@ export default function Ansi(props) {
30
32
< code >
31
33
{ ansiToInlineStyle ( text ) . map ( inlineBundleToReact ) }
32
34
</ code >
33
- )
35
+ ) ;
34
36
}
35
37
38
+ Ansi . propTypes = {
39
+ text : React . PropTypes . string ,
40
+ } ;
You can’t perform that action at this time.
0 commit comments