zhiwen0905 commited on
Commit
aef5a44
·
1 Parent(s): b98ffb6

bugfix(#133): update ui in extension...

Browse files
Extension/src/pages/Panel/Message/index.css CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  .message {
2
  display: flex;
3
  flex-direction: column;
@@ -7,20 +17,16 @@
7
  .message_sent {
8
  width: fit-content;
9
  padding: 5px;
10
- border: #04c4f8 1px solid;
11
- border-radius: 3px;
12
- background-color: transparent;
13
- color: #04c4f8;
14
  align-self: end;
15
  }
16
 
17
  .message_received {
18
  width: fit-content;
19
  padding: 5px;
20
- border: #bc0fdb 1px solid;
21
- border-radius: 3px;
22
- background-color: transparent;
23
- color: #bc0fdb;
24
  }
25
 
26
 
 
1
+ [data-theme='light'] {
2
+ --send-theme-color: #0a164d;
3
+ --receive-theme-color: #0d0c0d;
4
+ }
5
+
6
+ [data-theme='dark'] {
7
+ --send-theme-color: #0a164d;
8
+ --receive-theme-color: #333333;
9
+ }
10
+
11
  .message {
12
  display: flex;
13
  flex-direction: column;
 
17
  .message_sent {
18
  width: fit-content;
19
  padding: 5px;
20
+ border-radius: 5px;
21
+ background-color: var(--send-theme-color);
 
 
22
  align-self: end;
23
  }
24
 
25
  .message_received {
26
  width: fit-content;
27
  padding: 5px;
28
+ border-radius: 5px;
29
+ background-color: var(--receive-theme-color);
 
 
30
  }
31
 
32
 
Extension/src/pages/Panel/Panel.css CHANGED
@@ -1,10 +1,21 @@
 
 
 
 
 
 
 
 
 
 
1
  .main-layout {
2
  display: flex;
3
  flex-direction: column;
4
  height: 350px; /* Set the height of the layout to be 100% of the viewport */
5
  width: 400px;
6
- border-radius: 5px;
7
- background-color: #f5f5f5dd;
 
8
  }
9
 
10
  .main-layout .ant-layout-content {
@@ -19,6 +30,7 @@
19
  .footer {
20
  padding: 10px;
21
  justify-self: end;
 
22
  }
23
 
24
  .content {
@@ -44,4 +56,5 @@
44
 
45
  .divider {
46
  margin: 0;
 
47
  }
 
1
+ [data-theme='light'] {
2
+ --font-color: #c9d1d9;
3
+ --theme-color: #333333;
4
+ }
5
+
6
+ [data-theme='dark'] {
7
+ --font-color: #aeafb2;
8
+ --theme-color: #0d0c0d;
9
+ }
10
+
11
  .main-layout {
12
  display: flex;
13
  flex-direction: column;
14
  height: 350px; /* Set the height of the layout to be 100% of the viewport */
15
  width: 400px;
16
+ border-radius: 10px;
17
+ background-color: var(--theme-color);
18
+ color: var(--font-color);
19
  }
20
 
21
  .main-layout .ant-layout-content {
 
30
  .footer {
31
  padding: 10px;
32
  justify-self: end;
33
+ background-color: var(--theme-color);
34
  }
35
 
36
  .content {
 
56
 
57
  .divider {
58
  margin: 0;
59
+ background-color: grey;
60
  }
Extension/src/pages/Panel/Panel.jsx CHANGED
@@ -231,8 +231,20 @@ const Panel = () => {
231
  return data
232
  }
233
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  return (
235
- <Layout className="main-layout">
236
  <div className="header">
237
  <h4>RisingBrowser</h4>
238
  </div>
 
231
  return data
232
  }
233
 
234
+ /// Check if the user's system is in dark mode
235
+ const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
236
+ const isDarkMode = darkModeMediaQuery.matches;
237
+
238
+ const handleThemeChange = (e) => {
239
+ const isDarkMode = e.matches;
240
+ // Do something based on the new theme data
241
+ };
242
+
243
+ // Listen for changes in the theme data
244
+ darkModeMediaQuery.addEventListener('change', handleThemeChange);
245
+
246
  return (
247
+ <Layout className="main-layout" data-theme={isDarkMode ? 'dark': 'light'}>
248
  <div className="header">
249
  <h4>RisingBrowser</h4>
250
  </div>