Skip to content

Commit 2febe55

Browse files
committed
fix(doc): 文档主题色 BUG 修复
1 parent 0bdbe03 commit 2febe55

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

website/src/component/DarkMode/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function DarkMode() {
77
const theme = localStorage.getItem('theme');
88
const [dark, setDark] = useState(!!theme);
99
useEffect(() => {
10-
document.documentElement.dataset.theme = dark ? 'dark' : '';
10+
document.documentElement.dataset.theme = dark ? 'dark' : 'light';
1111
}, [dark]);
1212
return (
1313
<Switch

website/src/component/Header/index.module.less

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
width: 100%;
1010
}
1111

12+
html[data-color-mode*='dark'] .warpper {
13+
background-color: #0d1117;
14+
border-bottom: 1px solid #032438;
15+
}
16+
1217
.inner {
1318
margin: 0 auto;
1419
display: flex;
@@ -19,6 +24,7 @@
1924

2025
.menus {
2126
display: flex;
27+
2228
a {
2329
transition: all 0.3s;
2430
color: #333;
@@ -27,9 +33,11 @@
2733
display: flex;
2834
align-items: center;
2935
}
36+
3037
a + a {
3138
margin-left: 6px;
3239
}
40+
3341
:global(.active),
3442
a:hover {
3543
background: #00000017;
@@ -41,6 +49,7 @@
4149
display: flex;
4250
align-items: center;
4351
color: #333;
52+
4453
img {
4554
margin-right: 8px;
4655
height: 38px;
@@ -53,9 +62,11 @@
5362
line-height: 14px;
5463
font-weight: bold;
5564
padding-left: 8px;
65+
5666
> :first-child {
5767
font-size: 18px;
5868
}
69+
5970
> :last-child {
6071
margin-bottom: -10px;
6172
font-size: 12px;

website/src/component/Header/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Link, NavLink } from 'react-router-dom';
22
import pkg from '@uiw/react-native/package.json';
33
import styles from './index.module.less';
4-
import DarkMode from '../DarkMode';
4+
import '@wcj/dark-mode';
55
import { ReactComponent } from '../../assets/logo-dark.svg';
66
import { ReactComponent as Github } from '../../assets/github.svg';
77

@@ -43,7 +43,7 @@ export default function Header(props: HeaderProps) {
4343
Web 组件
4444
</a>
4545
<NavLink to="/team">团队</NavLink>
46-
<DarkMode />
46+
<dark-mode permanent style={{ display: 'flex', alignItems: 'center' }} />
4747
<a target="__blank" href="https://github.com/uiwjs/react-native-uiw">
4848
<Github />
4949
</a>

website/src/component/Preview/index.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ const Markdown = styled(MarkdownPreview)`
2828
const getBooleanValue = (param, field, defaultValue) => {
2929
if (Reflect.has(param, field)) {
3030
const newValue = Reflect.get(param, field);
31-
if (newValue === 'true') {
32-
return true;
33-
}
34-
if (newValue === 'false') {
35-
return false;
36-
}
31+
return newValue === 'true';
3732
}
3833
return defaultValue;
3934
};

website/src/component/SubMenus/index.module.less

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
.warpper {
22
padding-right: 16px;
33
position: relative;
4+
45
a {
56
color: #5a5a5a;
67
transition: all 0.3s;
78
margin-left: 10px;
89
display: flex;
910
justify-content: space-between;
1011
padding: 10px 10px 10px 0;
12+
1113
svg {
1214
fill: #bbb;
1315
transition: fill 0.3s;
1416
}
17+
1518
&:hover {
1619
color: #1890ff;
20+
1721
svg {
1822
fill: #1890ff;
1923
}
2024
}
25+
2126
&:global(.active) {
2227
color: #1890ff;
2328
background-color: #f5f8fa;
2429
padding-left: 10px;
30+
31+
html[data-color-mode*='dark'] &:global {
32+
background-color: #061c31;
33+
}
2534
}
2635
}
2736
}
@@ -50,3 +59,11 @@
5059
top: 60px;
5160
bottom: 0;
5261
}
62+
63+
html[data-color-mode*='dark'] .divider {
64+
border-bottom: 1px solid #032438;
65+
}
66+
67+
html[data-color-mode*='dark'] .inner {
68+
border-right: 1px solid #032438;
69+
}

0 commit comments

Comments
 (0)