diff --git a/package.json b/package.json index 37205af..32bc216 100644 --- a/package.json +++ b/package.json @@ -31,4 +31,4 @@ "tailwindcss": "^3.4.1", "typescript": "^5" } -} +} \ No newline at end of file diff --git a/src/app/components/header.tsx b/src/app/components/header.tsx index 593e9ec..e52e789 100644 --- a/src/app/components/header.tsx +++ b/src/app/components/header.tsx @@ -12,16 +12,20 @@ export default function Header(props: { dict: Record; lang: stri const [activeTab, setActiveTab] = useState(dict.home); const [show, setShow] = useState(false); const [hash, setHash] = useState("#home"); + useEffect(() => { - const designWidth = 1440; - const deviceWidth = document.documentElement.clientWidth; - let scale = 1; - console.log("designWidth", deviceWidth); - if (deviceWidth <= 1440) { - scale = deviceWidth / designWidth; - } - console.log("scale", scale); - document.documentElement.style.fontSize = `${scale * 14.4}px`; + // const designWidth = 1440; + // const deviceWidth = document.documentElement.clientWidth; + // let scale = 1; + // console.log("designWidth", deviceWidth); + // if (deviceWidth <= 1440) { + // scale = deviceWidth / designWidth; + // } + // console.log("scale", scale); + // document.documentElement.style.fontSize = `${scale * 14.4}px`; + }, [hash]); + + const handleJumpTo = (hash: string) => { switch (hash) { case "#home": const home = document.getElementById("home"); @@ -52,7 +56,7 @@ export default function Header(props: { dict: Record; lang: stri }); break; } - }, [hash]); + }; const navList: NavType[] = [ { @@ -84,10 +88,19 @@ export default function Header(props: { dict: Record; lang: stri
{navList.map((item: NavType) => ( -
setHash(item.href)} key={item.name}> -
setActiveTab(item.name)}> +
handleJumpTo(item.href)} key={item.name}> +
{ + setActiveTab(item.name); + }} + >
{item.name}
- {activeTab === item.name ? :
} + {activeTab === item.name ? ( + + ) : ( +
+ )}
))} @@ -100,7 +113,11 @@ export default function Header(props: { dict: Record; lang: stri > logo
{dict?.lang}
- logo + logo
{
setShow(false)}> diff --git a/src/app/globals.css b/src/app/globals.css index 56290e2..4e061fd 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -2,11 +2,15 @@ @tailwind components; @tailwind utilities; -::-webkit-scrollbar { - display: none; +html::-webkit-scrollbar { + width: 8px; } -.main { - -ms-overflow-style: none; - scrollbar-width: none; +html::-webkit-scrollbar-thumb { + background-color: rgba(169, 169, 169, 0.729); + border-radius: 10px; +} + +html::-webkit-scrollbar-track { + background: #fff; }