File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -37,17 +37,26 @@ loaders.forEach((loader => {
37
37
*
38
38
*/
39
39
40
+ if ( ! localStorage . defaultToolTheme ) {
41
+ localStorage . setItem ( 'defaultToolTheme' , 'light' ) ;
42
+ } else {
43
+ document . body . classList = localStorage . getItem ( 'defaultToolTheme' ) ;
44
+ }
45
+
46
+
40
47
const tdName = document . querySelectorAll ( '[data-td-name]' ) ;
41
48
tdName . forEach ( name => {
42
49
name . textContent = 'Choose a Techdegree'
43
50
} ) ;
44
51
const lightTheme = document . getElementById ( 'light' ) ;
45
52
const darkTheme = document . getElementById ( 'dark' ) ;
46
53
lightTheme . addEventListener ( 'click' , ( ) => {
47
- document . body . classList = '' ;
54
+ document . body . classList = 'light' ;
55
+ localStorage . setItem ( 'defaultToolTheme' , 'light' ) ;
48
56
} ) ;
49
57
darkTheme . addEventListener ( 'click' , ( ) => {
50
58
document . body . classList = 'dark' ;
59
+ localStorage . setItem ( 'defaultToolTheme' , 'dark' ) ;
51
60
} ) ;
52
61
53
62
Original file line number Diff line number Diff line change @@ -37,17 +37,26 @@ loaders.forEach((loader => {
37
37
*
38
38
*/
39
39
40
+ if ( ! localStorage . defaultToolTheme ) {
41
+ localStorage . setItem ( 'defaultToolTheme' , 'light' ) ;
42
+ } else {
43
+ document . body . classList = localStorage . getItem ( 'defaultToolTheme' ) ;
44
+ }
45
+
46
+
40
47
const tdName = document . querySelectorAll ( '[data-td-name]' ) ;
41
48
tdName . forEach ( name => {
42
49
name . textContent = 'Choose a Techdegree'
43
50
} ) ;
44
51
const lightTheme = document . getElementById ( 'light' ) ;
45
52
const darkTheme = document . getElementById ( 'dark' ) ;
46
53
lightTheme . addEventListener ( 'click' , ( ) => {
47
- document . body . classList = '' ;
54
+ document . body . classList = 'light' ;
55
+ localStorage . setItem ( 'defaultToolTheme' , 'light' ) ;
48
56
} ) ;
49
57
darkTheme . addEventListener ( 'click' , ( ) => {
50
58
document . body . classList = 'dark' ;
59
+ localStorage . setItem ( 'defaultToolTheme' , 'dark' ) ;
51
60
} ) ;
52
61
53
62
You can’t perform that action at this time.
0 commit comments