"use client" import React, { useEffect, useState } from 'react' import Link from 'next/link' import { FiChevronDown, FiChevronUp } from 'react-icons/fi'; import { CoursesProps } from '@/types' //define props type type Props = { showNav: boolean; courses: CoursesProps[] } const MobileNav = ({ showNav, courses }: Props) => { const [dropdownOpen, setDropdownOpen] = useState(false); useEffect(() => { if (showNav) { document.body.classList.add('overflow-hidden'); } else { document.body.classList.remove('overflow-hidden'); } return () => { document.body.classList.remove('overflow-hidden'); }; }, [showNav]); const navOpen = showNav ? 'translate-x-0' : 'translate-x-[-100%]' const navClose = !showNav ? 'translate-x-[-100%]' : 'translate-x-0' return (
{/*overlay*/}
{/* nav links*/}

主頁

setDropdownOpen(!dropdownOpen)} >

課程

{dropdownOpen ? : }
{dropdownOpen && (
{courses?.map((course, index) => (

{course.title}

))}
)}

電子管風琴

關於我們

) } export default MobileNav