Skip to content

Commit db21b00

Browse files
authored
Merge pull request #29 from MelanieH7/menunu
FIX: Updating 'menu' button colouring to follow the selected colour theme
2 parents 85913f2 + a14ad88 commit db21b00

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

src/App.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ function App() {
9494
};
9595

9696
useEffect(() => {
97-
setTheme(getWithExpiry(SYSTEM_THEME_KEY));
97+
const theme = getWithExpiry(SYSTEM_THEME_KEY);
98+
setTheme(theme);
9899
setAlgoTheme(getWithExpiry(ALGO_THEME_KEY));
99-
});
100+
document.documentElement.setAttribute('data-theme', theme === 'dark' ? 'dark' : 'light');
101+
}, []);
100102

101103
return (
102104
<GlobalProvider>

src/styles/AlgorithmMenu.scss

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
button {
66
padding: 8px 12px;
7-
background-color: #f0f0f0;
8-
border: none;
7+
background-color: var(--menu-background);
8+
color: var(--menu-text);
9+
border: 1px solid var(--menu-text);
910
cursor: pointer;
1011
font-size: 0.9em;
1112
}
@@ -14,27 +15,28 @@
1415
position: absolute;
1516
top: 100%;
1617
left: 0;
17-
background-color: white;
18-
border: 1px solid #ccc;
18+
background-color: var(--menu-background);
19+
border: 1px solid var(--menu-text);
1920
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
2021
z-index: 1000;
2122

2223
.category {
2324
padding: 8px 12px;
2425
cursor: pointer;
2526
position: relative;
26-
font-size: 0.9em;
27+
font-size: 0.9em;
28+
color: var(--menu-text);
2729

2830
&:hover {
29-
background-color: #f0f0f0;
31+
background-color: var(--menu-hover-background);
3032
}
3133

3234
.subcategory {
3335
position: absolute;
3436
left: 100%;
3537
top: 0;
36-
background-color: white;
37-
border: 1px solid #ccc;
38+
background-color: var(--menu-background);
39+
border: 1px solid var(--menu-text);
3840
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
3941
width: 250px;
4042
display: flex;
@@ -43,14 +45,14 @@
4345
a {
4446
padding: 6px 10px;
4547
text-decoration: none;
46-
color: black;
48+
color: var(--menu-text);
4749
font-size: 0.85em;
4850

4951
&:hover {
50-
background-color: #f0f0f0;
52+
background-color: var(--menu-hover-background);
5153
}
5254
}
5355
}
5456
}
5557
}
56-
}
58+
}

src/styles/App.scss

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ body {
55
padding: 0;
66
font-family: Roboto, 'sans-serif';
77
-webkit-font-smoothing: subpixel-antialiased;
8+
color: var(--text-color);
9+
background-color: var(--background-color);
810
}
911

1012
$handleLen: 40px;
@@ -167,7 +169,7 @@ $dragBarWidth: 10px;
167169
display: flex;
168170
justify-content: space-between;
169171
align-items: center;
170-
background-color: #f0f0f0;
172+
background-color: #1B2A41;
171173
}
172174

173175
.header-left {
@@ -178,4 +180,21 @@ $dragBarWidth: 10px;
178180
flex: 18;
179181
display: flex;
180182
justify-content: flex-end;
181-
}
183+
}
184+
185+
186+
:root {
187+
--text-color: #000;
188+
--background-color: #fff;
189+
--menu-background: #fff;
190+
--menu-text: #000;
191+
--menu-hover-background: #f0f0f0;
192+
}
193+
194+
[data-theme="dark"] {
195+
--text-color: #fff;
196+
--background-color: #000;
197+
--menu-background: #333;
198+
--menu-text: #fff;
199+
--menu-hover-background: #444;
200+
}

src/styles/Settings.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ $headerHeight: 30px;
9090
}
9191
}
9292

93-
.label {
94-
95-
}
96-
9793
}
9894

9995
$btnSize: 48px;

0 commit comments

Comments
 (0)