Skip to content

Commit 8dd9633

Browse files
committed
feat: navbar调整
1 parent ac78bf9 commit 8dd9633

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

components/navbar/index.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
import {FC, useContext, useEffect} 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 {IconGithubLogo, IconMoon, IconSun} from '@douyinfe/semi-icons';
8+
import { Tooltip, SideSheet } from '@douyinfe/semi-ui';
9+
import {IconGithubLogo, IconMoon, IconSun, IconBox} from '@douyinfe/semi-icons';
910
import {Themes} from "@/constants/enum";
1011

1112
export interface INavBarProps {
1213
}
1314

1415
const NavBar: FC<INavBarProps> = ({}) => {
16+
const [visible, setVisible] = useState<boolean>(false);
1517
const {setTheme, theme} = useContext(ThemeContext);
1618
const icon = theme === Themes.light ? logoTextDark : logoText;
1719
const iconTheme = theme === Themes.light ? <IconMoon size="extra-large"/> : <IconSun size="extra-large"/>;
20+
const onChange = () => {
21+
setVisible(!visible);
22+
};
1823
return (
1924
<div className={styles.navBar}>
2025
<a href="https://iotsharp.io/">
@@ -32,7 +37,14 @@ const NavBar: FC<INavBarProps> = ({}) => {
3237
}
3338
}}
3439
>
35-
{iconTheme}
40+
<Tooltip position="bottom" content={Themes.light ? '切换到暗色模式' : '切换到亮色模式'}>
41+
{iconTheme}
42+
</Tooltip>
43+
</div>
44+
<div className={styles.icon} onClick={onChange}>
45+
<Tooltip position="bottom" content="查看安装包">
46+
<IconBox size="extra-large"/>
47+
</Tooltip>
3648
</div>
3749
<div className={styles.icon} onClick={(): void => {
3850
window.open(
@@ -41,9 +53,14 @@ const NavBar: FC<INavBarProps> = ({}) => {
4153
"noopener=yes,noreferrer=yes"
4254
);
4355
}}>
44-
<IconGithubLogo size="extra-large"/>
56+
<Tooltip position="bottom" content="查看Github">
57+
<IconGithubLogo size="extra-large"/>
58+
</Tooltip>
4559
</div>
4660
</div>
61+
<SideSheet title="安装包" visible={visible} onCancel={onChange} placement="right">
62+
<p>Here is more content...</p>
63+
</SideSheet>
4764
</div>
4865
);
4966
};

components/navbar/styles.module.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44
justify-content: space-between;
55
background-color: hsla(0,0%,100%,.5);
66
backdrop-filter: blur(0.5rem);
7+
border-bottom: 1px solid var(--semi-color-border);
78
width: 100%;
89
height: 4rem;
910
position: sticky;
1011
top: 0;
1112
left: 0;
12-
padding: 1.25rem 8rem;
13+
padding: 1.25rem 2rem;
1314
z-index: 100;
1415
box-sizing: border-box;
1516

1617
.icon {
1718
cursor: pointer;
18-
margin-left: 1rem;
19+
margin-left: 1.8rem;
1920
}
2021

2122
a {

0 commit comments

Comments
 (0)