1- import { FC , useContext , useEffect } from "react" ;
1+ import { FC , useContext , useState } from "react" ;
22import styles from "./styles.module.scss" ;
33import Image from "next/image" ;
44import logoIcon from "@/public/logo-icon.svg" ;
55import logoTextDark from "@/public/logo-text-dark.svg" ;
66import logoText from "@/public/logo-text.svg" ;
77import { 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' ;
910import { Themes } from "@/constants/enum" ;
1011
1112export interface INavBarProps {
1213}
1314
1415const 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} ;
0 commit comments