我正试图利用13.4.7的卫星数据,并使用<条码>下使用Media Query,以发现这种观点是否具有流动性。 我的构成部分不是服务器构成部分,但我保留<代码>只读代码>。 h 错误。 现在,我的客户部分是服务器组成部分的一部分,但从文件来看,似乎允许这样做。 我失踪了吗? 如下:
"use client";
import { useContext, useState, useEffect } from "react";
import PageDataContext from "@/contexts/PageDataContext";
import useMediaQuery from "@/hooks/useMediaQuery";
import { motion } from "framer-motion";
export default function Header() {
const content = useContext(PageDataContext);
const isSmallDevice = useMediaQuery("only screen and (max-width : 991px)");
const [hideNav, setHideNav] = useState(isSmallDevice);
const { home: homeContent } = content;
const { navigation: navigationContent } = content;
const { name } = homeContent;
const [firstName, lastName] = name.split(" ");
const onTheRight = { x: "100%" };
const inTheCenter = { x: 0 };
const onTheLeft = { x: "-100%" };
const transition = { duration: 0.6, ease: "easeInOut" };
const variants = {
open: { opacity: 1, x: "0%" },
closed: { opacity: 0, x: "100%" },
};
const toggleSideNav = () => {
setHideNav(!hideNav);
};
useEffect(() => {
setHideNav(isSmallDevice);
}, [isSmallDevice]);
return (
<header id="site_header" className="header">
<div className="header-content clearfix">
<div className="text-logo">
<a href="/">
<div className="logo-symbol">{firstName[0].toUpperCase()}</div>
<div className="logo-text">
{firstName} <span>{lastName}</span>
</div>
</a>
</div>
<motion.div
animate={hideNav ? "closed" : "open"}
variants={variants}
style={{
position: "fixed",
width: "100%",
height: "calc(100% - 52px)",
top: "52px",
left: "auto",
}}
>
<div className="site-nav">
<ul className="leven-classic-menu site-main-menu">
{navigationContent.map((item, idx) => (
<li className="menu-item" key={"header_key_" + idx}>
<a href={item.url}>{item.title}</a>
</li>
))}
</ul>
</div>
</motion.div>
<a className="menu-toggle mobile-visible" onClick={toggleSideNav}>
<i className="fa fa-bars"></i>
</a>
</div>
</header>
);
}