updated
This commit is contained in:
parent
a583b8c5ad
commit
b9c5a7096a
|
@ -23,7 +23,7 @@ export const metadata = {
|
||||||
description: "**",
|
description: "**",
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function Page({ params }: { params: { slug: string } }) {
|
export default async function Page() {
|
||||||
const courses = await getCourses();
|
const courses = await getCourses();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
const aboutus = await getAboutus();
|
const aboutus = await getAboutus();
|
||||||
|
@ -32,7 +32,7 @@ export default async function Page({ params }: { params: { slug: string } }) {
|
||||||
return (
|
return (
|
||||||
<div className='bg-[#F6E8E9]'>
|
<div className='bg-[#F6E8E9]'>
|
||||||
<ResponsiveNav courses={courses} settings={settings} />
|
<ResponsiveNav courses={courses} settings={settings} />
|
||||||
<Home courses={courses} settings={settings} aboutus={aboutus} />
|
<Home settings={settings} aboutus={aboutus} />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,10 +9,10 @@ async function getCourses() {
|
||||||
const courses = await fetchCourses();
|
const courses = await fetchCourses();
|
||||||
return courses;
|
return courses;
|
||||||
}
|
}
|
||||||
async function getCourse(slug: string) {
|
// async function getCourse(slug: string) {
|
||||||
const course = await fetchCourse(slug);
|
// const course = await fetchCourse(slug);
|
||||||
return course;
|
// return course;
|
||||||
}
|
// }
|
||||||
|
|
||||||
async function getSettings() {
|
async function getSettings() {
|
||||||
const settings = await fetchSettings();
|
const settings = await fetchSettings();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Home from "../components/Home/Home";
|
import Home from "../components/Home/Home";
|
||||||
import { fetchCourses, fetchSettings} from "../utils/index";
|
import { fetchCourses, fetchSettings} from "../utils/index";
|
||||||
import ResponsiveNav from "../components/Navbar/ResponsiveNav";
|
import ResponsiveNav from "../components/Navbar/ResponsiveNav";
|
||||||
type Props = {}
|
|
||||||
|
|
||||||
async function getCourses() {
|
async function getCourses() {
|
||||||
const courses = await fetchCourses();
|
const courses = await fetchCourses();
|
||||||
|
@ -18,7 +18,7 @@ export const metadata = {
|
||||||
description: "**",
|
description: "**",
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function HomePage({}: Props) {
|
export default async function HomePage() {
|
||||||
const courses = await getCourses();
|
const courses = await getCourses();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -7,9 +7,9 @@ import ContactForm from "../ContactForm";
|
||||||
import AboutusContent from "./AboutusContent";
|
import AboutusContent from "./AboutusContent";
|
||||||
import Banner from "./Banner";
|
import Banner from "./Banner";
|
||||||
import Map from "./Map";
|
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 [loading, setLoading] = useState(true);
|
||||||
// const [courses, setCourses] = useState<CoursesProps[]>([]);
|
// const [courses, setCourses] = useState<CoursesProps[]>([]);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ interface CollapseProps {
|
||||||
|
|
||||||
const Collapse: React.FC<CollapseProps> = ({ title, children, className, info, info_images, }) => {
|
const Collapse: React.FC<CollapseProps> = ({ title, children, className, info, info_images, }) => {
|
||||||
const [currentSlide, setCurrentSlide] = useState(0);
|
const [currentSlide, setCurrentSlide] = useState(0);
|
||||||
var settings2 = {
|
const settings2 = {
|
||||||
arrows: false,
|
arrows: false,
|
||||||
infinite: true,
|
infinite: true,
|
||||||
//centerPadding: "30px",
|
//centerPadding: "30px",
|
||||||
|
@ -44,7 +44,7 @@ const Collapse: React.FC<CollapseProps> = ({ title, children, className, info, i
|
||||||
dotsClass: 'dots_custom'
|
dotsClass: 'dots_custom'
|
||||||
};
|
};
|
||||||
|
|
||||||
var settings1 = {
|
const settings1 = {
|
||||||
arrows: false,
|
arrows: false,
|
||||||
className: "center",
|
className: "center",
|
||||||
centerMode: true,
|
centerMode: true,
|
||||||
|
|
|
@ -37,7 +37,7 @@ function SampleNextArrow(props: any) {
|
||||||
|
|
||||||
const CourseImagesSilder = ({ courseData }: { courseData: CoursesProps }) => {
|
const CourseImagesSilder = ({ courseData }: { courseData: CoursesProps }) => {
|
||||||
const [currentSlide, setCurrentSlide] = useState(0);
|
const [currentSlide, setCurrentSlide] = useState(0);
|
||||||
var settings = {
|
const settings = {
|
||||||
arrows: false,
|
arrows: false,
|
||||||
className: "center",
|
className: "center",
|
||||||
centerMode: true,
|
centerMode: true,
|
||||||
|
@ -65,7 +65,7 @@ const CourseImagesSilder = ({ courseData }: { courseData: CoursesProps }) => {
|
||||||
dotsClass: 'dots_custom'
|
dotsClass: 'dots_custom'
|
||||||
};
|
};
|
||||||
|
|
||||||
var settings2 = {
|
const settings2 = {
|
||||||
fade: true,
|
fade: true,
|
||||||
centerMode: true,
|
centerMode: true,
|
||||||
infinite: true,
|
infinite: true,
|
||||||
|
|
|
@ -7,11 +7,11 @@ import { CoursesProps } from '@/types'
|
||||||
//define props type
|
//define props type
|
||||||
type Props = {
|
type Props = {
|
||||||
showNav: boolean;
|
showNav: boolean;
|
||||||
closeNav: () => void
|
|
||||||
courses: CoursesProps[]
|
courses: CoursesProps[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const MobileNav = ({ closeNav, showNav, courses }: Props) => {
|
const MobileNav = ({ showNav, courses }: Props) => {
|
||||||
const [dropdownOpen, setDropdownOpen] = useState(false);
|
const [dropdownOpen, setDropdownOpen] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (showNav) {
|
if (showNav) {
|
||||||
|
@ -49,12 +49,12 @@ const MobileNav = ({ closeNav, showNav, courses }: Props) => {
|
||||||
onClick={() => setDropdownOpen(!dropdownOpen)}
|
onClick={() => setDropdownOpen(!dropdownOpen)}
|
||||||
>
|
>
|
||||||
<p className="text-xl text-black">課程</p>
|
<p className="text-xl text-black">課程</p>
|
||||||
{dropdownOpen ? <FiChevronUp className='text-black' size={30}/> : <FiChevronDown className='text-black' size={30}/>}
|
{dropdownOpen ? <FiChevronUp className='text-black' size={30} /> : <FiChevronDown className='text-black' size={30} />}
|
||||||
</div>
|
</div>
|
||||||
{dropdownOpen && (
|
{dropdownOpen && (
|
||||||
<div>
|
<div>
|
||||||
{courses?.map((course) => (
|
{courses?.map((course, index) => (
|
||||||
<div className='bg-[#F5DADF] w-full h-16 flex justify-start items-center border-b-[1.5px] border-[#F9E7E9]'>
|
<div key={index} className='bg-[#F5DADF] w-full h-16 flex justify-start items-center border-b-[1.5px] border-[#F9E7E9]'>
|
||||||
<Link key={course.id} href={`/courses/${course.id}`}>
|
<Link key={course.id} href={`/courses/${course.id}`}>
|
||||||
<p className="text-lg text-black ml-8 ">
|
<p className="text-lg text-black ml-8 ">
|
||||||
{course.title}
|
{course.title}
|
||||||
|
|
|
@ -7,12 +7,12 @@ import { CoursesProps,SettingsProps } from '@/types'
|
||||||
const ResponsiveNav = ({ courses, settings }: { courses: CoursesProps[], settings: SettingsProps }) => {
|
const ResponsiveNav = ({ courses, settings }: { courses: CoursesProps[], settings: SettingsProps }) => {
|
||||||
const [showNav, setShowNav] = useState(false)
|
const [showNav, setShowNav] = useState(false)
|
||||||
const toggleNavHandler = () => setShowNav(!showNav)
|
const toggleNavHandler = () => setShowNav(!showNav)
|
||||||
const closeNavHandler = () => setShowNav(false)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Nav openNav={toggleNavHandler} showNav={showNav} courses={courses} settings={settings} />
|
<Nav openNav={toggleNavHandler} showNav={showNav} courses={courses} settings={settings} />
|
||||||
<MobileNav showNav={showNav} closeNav={closeNavHandler} courses={courses} />
|
<MobileNav showNav={showNav} courses={courses} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue