@@ -7,14 +7,28 @@ export default class Options extends React.Component {
7
7
super ( props ) ;
8
8
this . state = {
9
9
showUrl : window . localStorage . showURL ,
10
- isSeparated : window . localStorage . getItem ( 'isSeparated' ) ,
10
+ isSeparated : window . localStorage . getItem ( 'isSeparated' ) || 'false' ,
11
11
isCollapsed : window . localStorage . getItem ( 'isCollapsed' ) || 'true' ,
12
12
theme : window . localStorage . getItem ( 'theme' ) || 'light'
13
13
} ;
14
+ this . changeTheme = this . changeTheme . bind ( this ) ;
15
+ this . changeShowUrl = this . changeShowUrl . bind ( this ) ;
16
+ this . changeSeparated = this . changeSeparated . bind ( this ) ;
14
17
}
15
18
changeTheme ( event ) {
16
- this . setState ( { theme : event . target . value } ) ;
17
- window . localStorage . setItem ( 'theme' , event . target . value ) ;
19
+ const theme = event . target . value ;
20
+ this . setState ( { theme } ) ;
21
+ window . localStorage . setItem ( 'theme' , theme ) ;
22
+ }
23
+ changeShowUrl ( event ) {
24
+ const showUrl = event . target . checked ? 'true' : 'false' ;
25
+ this . setState ( { showUrl } ) ;
26
+ window . localStorage . showURL = showUrl ;
27
+ }
28
+ changeSeparated ( event ) {
29
+ const isSeparated = event . targed . checked ? 'true' : 'false' ;
30
+ this . setState ( { isSeparated } ) ;
31
+ window . localStorage . setItem ( 'isSeparated' , isSeparated ) ;
18
32
}
19
33
componentDidMount ( ) { }
20
34
render ( ) {
@@ -32,7 +46,12 @@ export default class Options extends React.Component {
32
46
< ul className = "options" >
33
47
< li >
34
48
< div >
35
- < input type = "checkbox" id = "showURL" />
49
+ < input
50
+ type = "checkbox"
51
+ id = "showURL"
52
+ checked = { this . state . showUrl }
53
+ onChange = { this . changeShowUrl }
54
+ />
36
55
< label className = "label" for = "showURL" >
37
56
Show tab URL
38
57
</ label >
@@ -45,7 +64,8 @@ export default class Options extends React.Component {
45
64
< div >
46
65
< input type = "checkbox" id = "collapse" />
47
66
< label className = "label" for = "collapse" >
48
- Dense tab list
67
+ Dense tab list (does it work after styled-components
68
+ migration?)
49
69
</ label >
50
70
</ div >
51
71
< div className = "optionTip" >
@@ -54,7 +74,12 @@ export default class Options extends React.Component {
54
74
< ul className = "options" >
55
75
< li >
56
76
< div >
57
- < input type = "checkbox" id = "separate" />
77
+ < input
78
+ type = "checkbox"
79
+ id = "separate"
80
+ checked = { this . state . isSeparated }
81
+ onChange = { this . changeSeparated }
82
+ />
58
83
< label className = "label" for = "separate" >
59
84
Show separators
60
85
</ label >
@@ -66,7 +91,11 @@ export default class Options extends React.Component {
66
91
</ ul >
67
92
</ li >
68
93
< li >
69
- < select value = { this . state . theme } name = "select" onChange = { this . changeTheme } >
94
+ < select
95
+ value = { this . state . theme }
96
+ name = "select"
97
+ onChange = { this . changeTheme }
98
+ >
70
99
{ Object . keys ( themes ) . map ( theme => (
71
100
< option value = { theme } selected = { this . state . theme === theme } >
72
101
{ theme }
0 commit comments