From b9c5a7096aad1e646de58d4656d4016f0639dd5c Mon Sep 17 00:00:00 2001 From: Philip Cheung Date: Tue, 8 Oct 2024 15:11:16 +0800 Subject: [PATCH] updated --- app/aboutus/page.tsx | 4 ++-- app/courses/[slug]/page.tsx | 8 ++++---- app/page.tsx | 4 ++-- components/Aboutus/Home.tsx | 4 ++-- components/Course/Collapse.tsx | 4 ++-- components/Course/CourseImagesSilder.tsx | 4 ++-- components/Navbar/MobileNav.tsx | 10 +++++----- components/Navbar/ResponsiveNav.tsx | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/aboutus/page.tsx b/app/aboutus/page.tsx index 2eb3598..6238133 100644 --- a/app/aboutus/page.tsx +++ b/app/aboutus/page.tsx @@ -23,7 +23,7 @@ export const metadata = { description: "**", } -export default async function Page({ params }: { params: { slug: string } }) { +export default async function Page() { const courses = await getCourses(); const settings = await getSettings(); const aboutus = await getAboutus(); @@ -32,7 +32,7 @@ export default async function Page({ params }: { params: { slug: string } }) { return (
- +
) diff --git a/app/courses/[slug]/page.tsx b/app/courses/[slug]/page.tsx index fd31b04..08e6ef2 100644 --- a/app/courses/[slug]/page.tsx +++ b/app/courses/[slug]/page.tsx @@ -9,10 +9,10 @@ async function getCourses() { const courses = await fetchCourses(); return courses; } -async function getCourse(slug: string) { - const course = await fetchCourse(slug); - return course; -} +// async function getCourse(slug: string) { +// const course = await fetchCourse(slug); +// return course; +// } async function getSettings() { const settings = await fetchSettings(); diff --git a/app/page.tsx b/app/page.tsx index 92ac095..2d43971 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,7 +1,7 @@ import Home from "../components/Home/Home"; import { fetchCourses, fetchSettings} from "../utils/index"; import ResponsiveNav from "../components/Navbar/ResponsiveNav"; -type Props = {} + async function getCourses() { const courses = await fetchCourses(); @@ -18,7 +18,7 @@ export const metadata = { description: "**", } -export default async function HomePage({}: Props) { +export default async function HomePage() { const courses = await getCourses(); const settings = await getSettings(); return ( diff --git a/components/Aboutus/Home.tsx b/components/Aboutus/Home.tsx index fe03ce8..e54a59a 100644 --- a/components/Aboutus/Home.tsx +++ b/components/Aboutus/Home.tsx @@ -7,9 +7,9 @@ import ContactForm from "../ContactForm"; import AboutusContent from "./AboutusContent"; import Banner from "./Banner"; import Map from "./Map"; -import { CoursesProps, SettingsProps, AboutusProps } from "@/types"; +import { SettingsProps, AboutusProps } from "@/types"; -const Home = ({ courses, settings, aboutus }: { courses: CoursesProps[], settings: SettingsProps, aboutus: AboutusProps[] }) => { +const Home = ({ settings, aboutus }: { settings: SettingsProps, aboutus: AboutusProps[] }) => { const [loading, setLoading] = useState(true); // const [courses, setCourses] = useState([]); diff --git a/components/Course/Collapse.tsx b/components/Course/Collapse.tsx index b252342..6229667 100644 --- a/components/Course/Collapse.tsx +++ b/components/Course/Collapse.tsx @@ -19,7 +19,7 @@ interface CollapseProps { const Collapse: React.FC = ({ title, children, className, info, info_images, }) => { const [currentSlide, setCurrentSlide] = useState(0); - var settings2 = { + const settings2 = { arrows: false, infinite: true, //centerPadding: "30px", @@ -44,7 +44,7 @@ const Collapse: React.FC = ({ title, children, className, info, i dotsClass: 'dots_custom' }; - var settings1 = { + const settings1 = { arrows: false, className: "center", centerMode: true, diff --git a/components/Course/CourseImagesSilder.tsx b/components/Course/CourseImagesSilder.tsx index 2cc56ef..0132fb6 100644 --- a/components/Course/CourseImagesSilder.tsx +++ b/components/Course/CourseImagesSilder.tsx @@ -37,7 +37,7 @@ function SampleNextArrow(props: any) { const CourseImagesSilder = ({ courseData }: { courseData: CoursesProps }) => { const [currentSlide, setCurrentSlide] = useState(0); - var settings = { + const settings = { arrows: false, className: "center", centerMode: true, @@ -65,7 +65,7 @@ const CourseImagesSilder = ({ courseData }: { courseData: CoursesProps }) => { dotsClass: 'dots_custom' }; - var settings2 = { + const settings2 = { fade: true, centerMode: true, infinite: true, diff --git a/components/Navbar/MobileNav.tsx b/components/Navbar/MobileNav.tsx index b45b1b1..e94d72d 100644 --- a/components/Navbar/MobileNav.tsx +++ b/components/Navbar/MobileNav.tsx @@ -7,11 +7,11 @@ import { CoursesProps } from '@/types' //define props type type Props = { showNav: boolean; - closeNav: () => void + courses: CoursesProps[] } -const MobileNav = ({ closeNav, showNav, courses }: Props) => { +const MobileNav = ({ showNav, courses }: Props) => { const [dropdownOpen, setDropdownOpen] = useState(false); useEffect(() => { if (showNav) { @@ -49,12 +49,12 @@ const MobileNav = ({ closeNav, showNav, courses }: Props) => { onClick={() => setDropdownOpen(!dropdownOpen)} >

課程

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

{course.title} diff --git a/components/Navbar/ResponsiveNav.tsx b/components/Navbar/ResponsiveNav.tsx index 0144958..a76075a 100644 --- a/components/Navbar/ResponsiveNav.tsx +++ b/components/Navbar/ResponsiveNav.tsx @@ -7,12 +7,12 @@ import { CoursesProps,SettingsProps } from '@/types' const ResponsiveNav = ({ courses, settings }: { courses: CoursesProps[], settings: SettingsProps }) => { const [showNav, setShowNav] = useState(false) const toggleNavHandler = () => setShowNav(!showNav) - const closeNavHandler = () => setShowNav(false) + return (

) }