import { useState, useEffect } from 'react'; import cl from 'classnames'; import { AIBPopover } from '../AIBPopover'; import styles from './index.module.css'; const content = [ { label: 'Dropshipping Copilot', icon: 'https://ae01.alicdn.com/kf/S516f381ed7364da083b7c55b0964a2c3M/76x76.png', desc: 'Dropshipping with AI, Stay ahead in selling winning products', link: 'https://dscopilot.edgeshop.ai/', id: 'nav_dsc', }, { label: 'AlphaRank', icon: 'https://ae01.alicdn.com/kf/Sf540fea0360040968b2e48fcfb7e728a9/76x76.png', desc: 'The Top Rated SEO Tool, Surge Traffic & Rankings by 50%+', link: 'https://alpha-rank.com/', id: 'nav_ar', }, { label: 'PicCopilot', icon: 'https://ae01.alicdn.com/kf/S492cad4a0bb7463e87ad69812aa23923z/76x76.png', desc: 'Make your product images stand out', link: 'https://www.piccopilot.com/home', id: 'nav_pic', }, ]; export const Header = () => { const [smallHeader, setSmallHeader] = useState(false); const navItems = [ { content: ( ), link: '', id: 'product', }, { content: 'Contact Us', link: '/contact-us', id: 'contact-us', }, ]; const handleScroll = () => { const scrollY = window.scrollY; // 获取垂直滚动的距离 const headerHeight = 64; // 设置触发变化的滚动距离 setSmallHeader(scrollY > headerHeight); // 根据滚动距离设置透明度 }; useEffect(() => { handleScroll(); // 组件加载后添加滚动监听 window.addEventListener('scroll', handleScroll); // 组件卸载前清除监听 return () => { window.removeEventListener('scroll', handleScroll); }; }, []); return (
edgeshop-log
{navItems.map((item, index) => { if (item.link) { return ( {item.content} ); } else return (
{item.content}
); })}
Join Discord
); };