// 'use client' // import React, {useState, useEffect, useCallback, useMemo} from 'react' // import Container from '@mui/material/Container' // import CardMedia from '@mui/material/CardMedia' // import { Box, Typography } from '@mui/material' // import Chip from '@mui/material/Chip'; // import { languages } from '@/utils/constant'; // import { Swiper, SwiperSlide } from 'swiper/react' // import { Navigation, Pagination, Scrollbar, A11y } from 'swiper/modules'; // import axiosInstance from '@/services/axiosInstance' // import { useDispatch, useSelector } from 'react-redux'; // import { setTopTenCourses } from '@/redux/slices/topTenSlice'; // import { toast } from 'react-toastify'; // import './TopTenCourses.css' // import 'swiper/css' // import 'swiper/css/navigation'; // import 'swiper/css/pagination'; // import 'swiper/css/scrollbar'; // const TopTenCourses = () => { // const [language, setLanguageState] = useState("en"); // const dispatch = useDispatch(); // const APIURL = process.env.NEXT_PUBLIC_API_URL; // const topTen = useSelector((state: any) => state.topTen); // const swiperConfig = { // slidesPerView: 1, // spaceBetween: 10, // // pagination: { clickable: true }, // scrollbar:{draggable: true}, // navigation: { enabled: true }, // autoplay: { delay: 2000 }, // breakpoints: { // 640: { slidesPerView: 1, spaceBetween: 20 }, // 768: { slidesPerView: 2, spaceBetween: 30 }, // 1024: { slidesPerView: 3, spaceBetween: 40 }, // }, // modules: [Navigation, Pagination, Scrollbar, A11y], // }; // const handleLanguageChange = useCallback((languageCode: string) => { // setLanguageState(languageCode); // if (languageCode != language) { // // axiosInstance.post(`${APIURL}/language_code/${languageCode}`) // axiosInstance.get(`${APIURL}/data/topten_en.json`) // .then((response) => { // dispatch(setTopTenCourses(response.data)); // // toast("Fetched Successfully"); // }) // .catch((error) => { // console.error(error); // // toast("Fetched Failed"); // }); // } // }, [language]); // return ( //
// // // Top 10 Courses in India today // // {languages.map((search, index) => ( // handleLanguageChange(search.language_code)} // className={search.language_code === language ? 'active' : ''} // /> // ))} // // // {topTen ? topTen.map((search: any, index: number) => ( // //
//
// {index+1} // //
// // {search.course_title} // //
//
// )) : ( //
Loading...
// )} //
//
//
//
// ) // } // export default TopTenCourses;