"use client" import React, { useState, useEffect } from 'react' import Image from 'next/image' import Link from 'next/link' import { FiChevronDown } from "react-icons/fi"; import { FaFacebookF, FaYoutube } from "react-icons/fa"; import { RiInstagramFill } from "react-icons/ri"; import { IoMenu, IoClose } from "react-icons/io5"; import { CoursesProps, SettingsProps } from '@/types' //define props type type Props = { openNav: () => void showNav: boolean courses: CoursesProps[] settings: SettingsProps } const Nav = ({ openNav, courses, showNav, settings }: Props) => { const [navBg, setNavBg] = useState(false) const [dropdownOpen, setDropdownOpen] = useState(false); useEffect(() => { const handler = () => { if (window.scrollY >= 90) { setNavBg(true) } else if (window.scrollY <= 90) { setNavBg(false) } } window.addEventListener("scroll", handler) return () => { window.removeEventListener("scroll", handler) } }, []); return (
logo

{"主頁"}

{dropdownOpen && (
{courses.map((course) => ( {course.title} ))}
)}

{"關於我們"}

{/*button*/}
window.open(settings.facebook)} >
window.open(settings.instagram)} >
window.open(settings.youtube)} >
{/*burger*/} {showNav ? ( ) : ( )}
) } export default Nav