Skip to content

Commit 9275dd0

Browse files
authored
Merge pull request #482 from nullptr-z/dev
fix(doc): 文档主题色 BUG 修复
2 parents 816a7f3 + 4a349d7 commit 9275dd0

File tree

5 files changed

+34
-6
lines changed

5 files changed

+34
-6
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/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+
}

website/src/routes/Controller.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Suspense } from 'react';
1+
import { Key, Suspense } from 'react';
22
import { Routes, Route, Navigate } from 'react-router-dom';
33
import { Loader } from 'uiw';
44
import { routeData } from '../routes/router';
@@ -16,7 +16,7 @@ export default function Controller() {
1616
<Route path="/" element={<Navigate replace to="/home" />} />
1717
<Route path="/docs" element={<Navigate replace to="/docs/getting-started" />} />
1818
<Route path="/components" element={<Navigate replace to="/components/about" />} />
19-
{routeData.map(({ component: BasicLayout, path, children = [] }, idx) => (
19+
{routeData.map(({ component: BasicLayout, path, children = [] }: any, idx) => (
2020
<Route
2121
path={path}
2222
key={idx}
@@ -26,7 +26,7 @@ export default function Controller() {
2626
</Suspense>
2727
}
2828
>
29-
{children.map((child, idx) => {
29+
{children.map((child: { component: any; path: string }, idx: Key | null | undefined) => {
3030
const Child = child.component as any;
3131
return (
3232
<Route

0 commit comments

Comments
 (0)