Skip to content

Commit 26f4b12

Browse files
committed
feat: unify IoTSharp website entry points
1 parent 9f24b62 commit 26f4b12

21 files changed

Lines changed: 2272 additions & 4161 deletions

‎components/footer/index.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ const linkGroups = [
2020
title: "开发者入口",
2121
links: [
2222
{label: "GitHub", link: "https://github.com/IoTSharp"},
23-
{label: "文档", link: "https://docs.iotsharp.net/"},
24-
{label: "商业服务", link: "https://iotsharp.online"},
23+
{label: "文档", link: "https://iotsharp.net/docs/"},
24+
{label: "AI 服务", link: "https://iotsharp.net/ai"},
25+
{label: "平台控制台", link: "https://iotsharp.net/console"},
2526
{label: "组织主页", link: "https://iotsharp.net"}
2627
]
2728
},

‎components/navbar/index.tsx‎

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import {FC, useContext} from "react";
1+
import {FC, useContext, useState} from "react";
22
import styles from "./styles.module.scss";
33
import Image from "next/image";
44
import logoIcon from "@/public/logo-icon.svg";
55
import logoTextDark from "@/public/logo-text-dark.svg";
66
import logoText from "@/public/logo-text.svg";
77
import {ThemeContext} from "@/stores/theme";
8-
import { Tooltip } from '@douyinfe/semi-ui';
9-
import {IconGithubLogo, IconMoon, IconSun} from '@douyinfe/semi-icons';
8+
import {Github, Menu, Moon, Sun, X} from 'lucide-react';
109
import {Themes} from "@/constants/enum";
1110

1211
export interface INavBarProps {
@@ -18,39 +17,48 @@ const navLinks = [
1817
{label: "IoTEdge", href: "https://iotsharp.net/IoTEdge/"},
1918
{label: "IoTEmBASIC", href: "https://iotsharp.net/IoTEmBASIC/"},
2019
{label: "更多项目", href: "#projects"},
21-
{label: "商业服务", href: "https://iotsharp.online"}
20+
{label: "商业服务", href: "https://iotsharp.net/console"}
2221
];
2322

2423
const NavBar: FC<INavBarProps> = ({}) => {
2524
const {setTheme, theme} = useContext(ThemeContext);
25+
const [menuOpen, setMenuOpen] = useState(false);
2626
const icon = theme === Themes.light ? logoTextDark : logoText;
27-
const iconTheme = theme === Themes.light ? <IconMoon size="extra-large"/> : <IconSun size="extra-large"/>;
27+
const themeLabel = theme === Themes.light ? '切换到暗色模式' : '切换到亮色模式';
28+
const iconTheme = theme === Themes.light ? <Moon size={24}/> : <Sun size={24}/>;
2829
return (
2930
<div className={styles.navBar}>
3031
<a href="https://iotsharp.net/">
3132
<Image src={logoIcon} alt="" width={35} height={35}/>
3233
<Image src={icon} alt="" width={135} height={40}/>
3334
</a>
34-
<nav className={styles.links} aria-label="主导航">
35+
<nav
36+
id="main-navigation"
37+
className={`${styles.links} ${menuOpen ? styles.linksOpen : ""}`}
38+
aria-label="主导航"
39+
>
3540
{navLinks.map((item) => {
3641
if (item.href.startsWith("http")) {
3742
return (
38-
<a href={item.href} key={item.href} target="_blank" rel="noreferrer">
43+
<a href={item.href} key={item.href} target="_blank" rel="noreferrer" onClick={() => setMenuOpen(false)}>
3944
{item.label}
4045
</a>
4146
);
4247
}
4348

4449
return (
45-
<a href={item.href} key={item.href}>
50+
<a href={item.href} key={item.href} onClick={() => setMenuOpen(false)}>
4651
{item.label}
4752
</a>
4853
);
4954
})}
5055
</nav>
5156
<div className={styles.themeArea}>
52-
<div
53-
className={styles.icon}
57+
<button
58+
type="button"
59+
className={styles.iconButton}
60+
title={themeLabel}
61+
aria-label={themeLabel}
5462
onClick={(): void => {
5563
if (localStorage.getItem("theme") === Themes.light) {
5664
setTheme(Themes.dark);
@@ -59,21 +67,28 @@ const NavBar: FC<INavBarProps> = ({}) => {
5967
}
6068
}}
6169
>
62-
<Tooltip position="bottom" content={Themes.light ? '切换到暗色模式' : '切换到亮色模式'}>
63-
{iconTheme}
64-
</Tooltip>
65-
</div>
66-
<div className={styles.icon} onClick={(): void => {
70+
{iconTheme}
71+
</button>
72+
<button type="button" className={styles.iconButton} title="查看 GitHub" aria-label="查看 GitHub" onClick={(): void => {
6773
window.open(
6874
"https://github.com/IoTSharp",
6975
"blank",
7076
"noopener=yes,noreferrer=yes"
7177
);
7278
}}>
73-
<Tooltip position="bottom" content="查看Github">
74-
<IconGithubLogo size="extra-large"/>
75-
</Tooltip>
76-
</div>
79+
<Github size={24}/>
80+
</button>
81+
<button
82+
type="button"
83+
className={`${styles.iconButton} ${styles.menuButton}`}
84+
title={menuOpen ? "关闭导航" : "打开导航"}
85+
aria-label={menuOpen ? "关闭导航" : "打开导航"}
86+
aria-expanded={menuOpen}
87+
aria-controls="main-navigation"
88+
onClick={() => setMenuOpen((open) => !open)}
89+
>
90+
{menuOpen ? <X size={24}/> : <Menu size={24}/>}
91+
</button>
7792
</div>
7893
</div>
7994
);

‎components/navbar/styles.module.scss‎

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
z-index: 100;
1515
box-sizing: border-box;
1616

17-
.icon {
18-
cursor: pointer;
19-
margin-left: 1.3rem;
20-
}
21-
2217
a {
2318
display: flex;
2419
align-items: center;
@@ -77,6 +72,31 @@
7772
cursor: pointer;
7873
}
7974
}
75+
76+
.iconButton {
77+
display: inline-flex;
78+
width: 2.5rem;
79+
height: 2.5rem;
80+
align-items: center;
81+
justify-content: center;
82+
margin-left: .5rem;
83+
padding: 0;
84+
border: 0;
85+
border-radius: .25rem;
86+
color: inherit;
87+
background: transparent;
88+
cursor: pointer;
89+
90+
&:hover,
91+
&:focus-visible {
92+
background: #f1eff8;
93+
outline: none;
94+
}
95+
}
96+
97+
.menuButton {
98+
display: none;
99+
}
80100
}
81101

82102
@media screen and (max-width: 47.9375rem) {
@@ -88,16 +108,26 @@
88108
padding: 0.8rem 1.25rem;
89109

90110
.links {
111+
display: none;
91112
order: 3;
92113
width: 100%;
93-
gap: 1rem;
94-
overflow-x: auto;
95-
padding-bottom: 0.2rem;
96-
white-space: nowrap;
114+
grid-template-columns: repeat(2, minmax(0, 1fr));
115+
gap: 0;
116+
overflow: hidden;
117+
border-top: 1px solid #e7e3f7;
118+
119+
a {
120+
min-height: 2.75rem;
121+
padding: 0.75rem 0.5rem;
122+
}
97123
}
98124

99-
.icon {
100-
margin-left: 1rem;
125+
.linksOpen {
126+
display: grid;
101127
}
128+
129+
.iconButton { margin-left: .25rem; }
130+
131+
.menuButton { display: inline-flex; }
102132
}
103133
}

‎next-env.d.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
import "./.next/types/routes.d.ts";
4+
import "./.next/types/root-params.d.ts";
35

46
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
7+
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

‎next.config.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
const path = require("path");
22

3-
const semi = require("@douyinfe/semi-next").default({});
4-
module.exports = semi({
3+
module.exports = {
54
reactStrictMode: true,
6-
swcMinify: true,
5+
output: "export",
76
webpack: (config) => {
87
config.resolve.alias = {
98
...config.resolve.alias,
@@ -12,7 +11,7 @@ module.exports = semi({
1211
return config;
1312
},
1413
images: {
15-
domains: ["127.0.0.1"],
14+
remotePatterns: [{ protocol: "http", hostname: "127.0.0.1" }],
1615
unoptimized: true
1716
},
18-
});
17+
};

0 commit comments

Comments
 (0)