updated
This commit is contained in:
parent
a583b8c5ad
commit
b9c5a7096a
|
@ -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 (
|
||||
<div className='bg-[#F6E8E9]'>
|
||||
<ResponsiveNav courses={courses} settings={settings} />
|
||||
<Home courses={courses} settings={settings} aboutus={aboutus} />
|
||||
<Home settings={settings} aboutus={aboutus} />
|
||||
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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<CoursesProps[]>([]);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ interface CollapseProps {
|
|||
|
||||
const Collapse: React.FC<CollapseProps> = ({ 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<CollapseProps> = ({ title, children, className, info, i
|
|||
dotsClass: 'dots_custom'
|
||||
};
|
||||
|
||||
var settings1 = {
|
||||
const settings1 = {
|
||||
arrows: false,
|
||||
className: "center",
|
||||
centerMode: true,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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) {
|
||||
|
@ -53,8 +53,8 @@ const MobileNav = ({ closeNav, showNav, courses }: Props) => {
|
|||
</div>
|
||||
{dropdownOpen && (
|
||||
<div>
|
||||
{courses?.map((course) => (
|
||||
<div className='bg-[#F5DADF] w-full h-16 flex justify-start items-center border-b-[1.5px] border-[#F9E7E9]'>
|
||||
{courses?.map((course, index) => (
|
||||
<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}`}>
|
||||
<p className="text-lg text-black ml-8 ">
|
||||
{course.title}
|
||||
|
|
|
@ -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 (
|
||||
<div>
|
||||
<Nav openNav={toggleNavHandler} showNav={showNav} courses={courses} settings={settings} />
|
||||
<MobileNav showNav={showNav} closeNav={closeNavHandler} courses={courses} />
|
||||
<MobileNav showNav={showNav} courses={courses} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue