File tree 4 files changed +44
-8
lines changed 4 files changed +44
-8
lines changed Original file line number Diff line number Diff line change 14
14
"react-helmet" : " ^5.2.0" ,
15
15
"react-scripts" : " 1.1.4" ,
16
16
"react-split-pane" : " ^0.1.77" ,
17
+ "react-switch" : " ^3.0.4" ,
17
18
"react-table" : " ^6.8.2" ,
18
19
"uast-viewer" : " ^0.0.4"
19
20
},
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Modal } from 'react-bootstrap';
3
3
import PropTypes from 'prop-types' ;
4
4
import SplitPane from 'react-split-pane' ;
5
5
import UASTViewer , { Editor , withUASTEditor } from 'uast-viewer' ;
6
+ import Switch from 'react-switch' ;
6
7
import api from '../api' ;
7
8
import './CodeViewer.less' ;
8
9
@@ -145,14 +146,21 @@ class CodeViewer extends Component {
145
146
< Modal . Header closeButton >
146
147
< Modal . Title >
147
148
CODE
148
- < label >
149
- < input
150
- type = "checkbox"
151
- checked = { showUast }
152
- onChange = { this . handleShowUastChange }
153
- disabled = { ! language }
154
- /> UAST
155
- </ label >
149
+ < Switch
150
+ checked = { showUast }
151
+ onChange = { this . handleShowUastChange }
152
+ disabled = { ! language }
153
+ checkedIcon = { < span className = "switch-text checked" > UAST</ span > }
154
+ uncheckedIcon = {
155
+ < span className = "switch-text unchecked" > UAST</ span >
156
+ }
157
+ onColor = "#ffba34"
158
+ offColor = "#e1e1e1"
159
+ width = { 100 }
160
+ handleDiameter = { 20 }
161
+ className = "code-toggler"
162
+ aria-label = "Toggle UAST view"
163
+ />
156
164
</ Modal . Title >
157
165
</ Modal . Header >
158
166
< Modal . Body >
Original file line number Diff line number Diff line change
1
+ @import ' ../variables.less' ;
2
+
1
3
.code-viewer {
2
4
position : relative ;
3
5
height : 100% ;
21
23
.editor-pane {
22
24
height : 100% ;
23
25
}
26
+
27
+ .code-toggler {
28
+ margin-left : 40px ;
29
+
30
+ .switch-text {
31
+ font-size : 18px ;
32
+ font-weight : @btn-font-weight ;
33
+ }
34
+
35
+ .switch-text.checked {
36
+ color : @btn-gbpl-tertiary-color ;
37
+ padding-left : 28px ;
38
+ }
39
+
40
+ .switch-text.unchecked {
41
+ color : #979797 ;
42
+ margin-left : -29px ;
43
+ }
44
+ }
Original file line number Diff line number Diff line change @@ -5944,6 +5944,12 @@ react-style-proptype@^3.0.0:
5944
5944
dependencies :
5945
5945
prop-types "^15.5.4"
5946
5946
5947
+ react-switch@^3.0.4 :
5948
+ version "3.0.4"
5949
+ resolved "https://registry.yarnpkg.com/react-switch/-/react-switch-3.0.4.tgz#52958b2736b4d21b4f0050997955c5365019ca7b"
5950
+ dependencies :
5951
+ prop-types "^15.6.1"
5952
+
5947
5953
react-table@^6.8.2 :
5948
5954
version "6.8.2"
5949
5955
resolved "https://registry.yarnpkg.com/react-table/-/react-table-6.8.2.tgz#3a5aefabc85953300d16786fa307c30610db9adc"
You can’t perform that action at this time.
0 commit comments