MCPcopy Create free account
hub / github.com/chiragksharma/BuildFast / Header

Function Header

src/components/Header.tsx:10–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9
10const Header: React.FC = () => {
11 const [isOpen, setIsOpen] = useState(false);
12 const [isPopupOpen, setIsPopupOpen] = useState(false);
13 const themeLinkRef = useRef<HTMLAnchorElement>(null);
14
15
16 const toggleMenu = () => {
17 setIsOpen(!isOpen);
18 };
19 const togglePopup = () => {
20 setIsPopupOpen(!isPopupOpen);
21 };
22
23 // const { logo, brand } = siteConfig;
24 const { brand,logo,links, cta, mobileMenu } = navbarConfig;
25
26 const IconOrPath = getIconByName(logo);
27
28
29 return (
30 <header className="max-w-7xl bg-navbar-bg mx-auto px-8 py-5 flex items-center justify-between md:py-10" id='Navbar'>
31 <div className="flex flex-row items-center align-middle gap-1 md:w-40 ">
32 {/* <motion.img src={logo} alt={`${brand} Logo`} fetchPriority='high' className='w-8 h-8 text-logo-text-color'
33 whileHover={{ scale: 1.1 }}
34 transition={{ type: 'spring', stiffness: 200 }}
35 /> */}
36 <motion.div
37 className="text-logo-icon-color"
38 whileHover={{ scale: 1.1 }}
39 transition={{ type: 'spring', stiffness: 200 }}
40 >
41 {typeof IconOrPath === 'string' ? (
42 <img src={IconOrPath} alt={brand} />
43 ) : (
44 <IconOrPath size={30} weight="fill" />
45 )}
46 </motion.div>
47 <h1 className="text-logo-text-color text-xl font-semibold">{brand}</h1>
48 </div>
49 <nav className="flex items-center pl-12 md:pl-20 gap-4 md:gap-4">
50 <div className="hidden md:flex items-center space-x-4">
51 {links.map((link, index) => (
52 <a key={index} href={link.href} className="text-foreground-hsl/95 font-brico hover:text-foreground-hsl/75 hover:underline px-3 py-2">
53 {link.text}
54 </a>
55 ))}
56 </div>
57 <div className="hidden md:flex items-center md:flex-row md:gap-3 ">
58 <a
59 ref={themeLinkRef}
60 className="cursor-pointer bg-transparent border font-brico text-nav-normal-btn-text border-navbar-border-color shadow-sm hover:border-nav-links-color px-4 py-2 rounded-lg flex flex-row items-center gap-2 transition delay-75 group"
61 onClick={(e) => {
62 e.preventDefault();
63 togglePopup();
64 }}
65 >
66 Themes
67 <PaintBucket size={20} weight='bold' />

Callers

nothing calls this directly

Calls 2

getIconByNameFunction · 0.90
togglePopupFunction · 0.85

Tested by

no test coverage detected