Commit 787c8ded authored by Phạm Quang Bảo's avatar Phạm Quang Bảo

fix/member in home page

parent 1b2c2a6a
import ImageNext from "@/components/shared/image-next"; import ImageNext from "@/components/shared/image-next";
import memberImages from "@/constants/memberImages"; import memberImages from "@/constants/memberImages";
import partnerImages from "@/constants/partnerImages";
import { ChevronsRight } from "lucide-react"; import { ChevronsRight } from "lucide-react";
import Link from "next/link"; import Link from "next/link";
import { Autoplay, Grid } from "swiper/modules"; import { Autoplay } from "swiper/modules";
import { Swiper, SwiperSlide } from "swiper/react"; import { Swiper, SwiperSlide } from "swiper/react";
import "swiper/css"; import "swiper/css";
import "swiper/css/grid"; import "swiper/css/grid";
import { GetNewsResponseType, NewsItem } from "@/api/types/news";
import BASE_URL from "@/links/index";
import { useGetNews } from "@/api/endpoints/news";
import { Spinner } from "@/components/ui/spinner";
const Members = () => { const Members = () => {
const { data, isLoading } = useGetNews<GetNewsResponseType>(
{
filters: `page_config.code @=ket-noi-hoi-vien`,
}
);
return ( return (
<section className="flex flex-col lg:flex-row gap-5 pb-10 mb-0"> <section className="flex flex-col lg:flex-row gap-5 pb-10 mb-0">
{/* LEFT: HỘI VIÊN TIÊU BIỂU */} {/* LEFT: HỘI VIÊN TIÊU BIỂU */}
...@@ -58,44 +66,48 @@ const Members = () => { ...@@ -58,44 +66,48 @@ const Members = () => {
</aside> </aside>
{/* RIGHT: KẾT NỐI HỘI VIÊN */} {/* RIGHT: KẾT NỐI HỘI VIÊN */}
<aside className="w-full lg:w-[30%] py-5"> {isLoading ? (
<div className="flex justify-between items-center mb-3"> <div className="flex justify-center items-center w-full h-64">
<h2 className="text-xl font-bold uppercase text-[#063e8e]"> <Spinner />
Kết nối hội viên
</h2>
</div> </div>
) : (
<hr className="border-[#063e8e] mb-5" /> <aside className="w-full lg:w-[30%] py-5">
<div className="flex justify-between items-center mb-3">
<Swiper <h2 className="text-xl font-bold uppercase text-[#063e8e]">
modules={[Autoplay, Grid]} Kết nối hội viên
autoplay={{ delay: 4000, disableOnInteraction: false }} </h2>
loop </div>
grid={{ rows: 2, fill: "row" }} <hr className="border-[#063e8e] mb-5" />
slidesPerView={3} <Swiper
spaceBetween={16} modules={[Autoplay]}
breakpoints={{ autoplay={{ delay: 4000, disableOnInteraction: false }}
0: { slidesPerView: 3, spaceBetween: 10, grid: { rows: 1 } }, loop
640: { slidesPerView: 3, spaceBetween: 16 }, className="partner-swiper"
1024: { slidesPerView: 3, spaceBetween: 24 }, >
}} {data?.responseData.rows.map((news: NewsItem) => (
className="partner-swiper" <SwiperSlide key={news.id}>
> <a href={`${news.external_link}`}>
{partnerImages.map((src, i) => ( <div className="w-full aspect-3/2 relative overflow-hidden mb-5">
<SwiperSlide key={i}> <ImageNext
<div className="flex justify-center items-center bg-white rounded-lg shadow p-3 w-[120px] h-[120px]"> src={`${BASE_URL.imageEndpoint}${news.thumbnail}`}
<ImageNext alt={news.title}
src={src} width={600}
alt={`partner-${i}`} height={400}
width={120} sizes="(max-width:768px) 100vw,50vw"
height={120} className="w-full h-full object-cover"
className="object-contain w-full h-full" />
/> <div className="absolute bg-white opacity-90 bottom-5 left-5 right-5 p-5">
</div> <p className="text-[#063e8e] font-semibold text-sm sm:text-base z-10 line-clamp-3">
</SwiperSlide> {news.title}
))} </p>
</Swiper> </div>
</aside> </div>
</a>
</SwiperSlide>
))}
</Swiper>
</aside>
)}
</section> </section>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment