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

fix/home pag

parent 5ffab2ff
...@@ -24,29 +24,29 @@ const Home = () => { ...@@ -24,29 +24,29 @@ const Home = () => {
const swiperRef = useRef<SwiperType | null>(null) const swiperRef = useRef<SwiperType | null>(null)
// server // server
// const { data: categoryData } = useGetCategory<GetCategoryAdminResponseType>(); const { data: categoryData } = useGetCategory<GetCategoryAdminResponseType>();
// const { data: allData, isLoading } = useGetNews<GetNewsResponseType>({ const { data: allData, isLoading } = useGetNews<GetNewsResponseType>({
// pageSize: '999', pageSize: '999',
// filters: submitSearch ? `title @=${submitSearch}` : undefined, filters: submitSearch ? `title @=${submitSearch}` : undefined,
// }) })
//tab filter //tab filter
// let data let data
// if (tab === 'all') { if (tab === 'all') {
// data = allData data = allData
// } else { } else {
// // fillter by category // fillter by category
// const filteredRows = allData?.responseData?.rows?.filter( const filteredRows = allData?.responseData?.rows?.filter(
// (news) => news.category === tab (news) => news.category === tab
// ) )
// data = { data = {
// ...allData, ...allData,
// responseData: { responseData: {
// ...allData?.responseData, ...allData?.responseData,
// rows: filteredRows ?? [] rows: filteredRows ?? []
// } }
// } }
// } }
// update slidesPerView on resize to match the Swiper breakpoints // update slidesPerView on resize to match the Swiper breakpoints
useEffect(() => { useEffect(() => {
...@@ -112,7 +112,7 @@ const Home = () => { ...@@ -112,7 +112,7 @@ const Home = () => {
setCurrentIndex(typeof swiper.realIndex === 'number' ? swiper.realIndex : swiper.activeIndex) setCurrentIndex(typeof swiper.realIndex === 'number' ? swiper.realIndex : swiper.activeIndex)
}} }}
> >
{/* {allData?.responseData.rows.map((news) => ( {allData?.responseData.rows.map((news) => (
<SwiperSlide key={news.id}> <SwiperSlide key={news.id}>
<a href={`/tin-tuc/${news.id}`} className='block bg-white shadow-md overflow-hidden relative'> <a href={`/tin-tuc/${news.id}`} className='block bg-white shadow-md overflow-hidden relative'>
<AppImage <AppImage
...@@ -134,7 +134,7 @@ const Home = () => { ...@@ -134,7 +134,7 @@ const Home = () => {
</div> </div>
</a> </a>
</SwiperSlide> </SwiperSlide>
))} */} ))}
<SwiperSlide> <SwiperSlide>
<a href={`#`} className='block bg-white shadow-md overflow-hidden relative'> <a href={`#`} className='block bg-white shadow-md overflow-hidden relative'>
...@@ -201,11 +201,11 @@ const Home = () => { ...@@ -201,11 +201,11 @@ const Home = () => {
{/* News list */} {/* News list */}
<div className='pb-5 overflow-hidden'> <div className='pb-5 overflow-hidden'>
{/* {data?.responseData.rows.slice(0, 5).map((news) => ( {data?.responseData.rows.slice(0, 5).map((news) => (
<NewsContent key={news.id} news={news} /> <NewsContent key={news.id} news={news} />
))} */} ))}
{/* <div className='w-full flex justify-center mt-4'> <div className='w-full flex justify-center mt-4'>
<AppPagination <AppPagination
page={Math.floor(currentIndex / Math.max(slidesPerView, 1)) + 1} page={Math.floor(currentIndex / Math.max(slidesPerView, 1)) + 1}
count={Math.ceil((data?.responseData.rows?.length ?? 0) / Math.max(slidesPerView, 1))} count={Math.ceil((data?.responseData.rows?.length ?? 0) / Math.max(slidesPerView, 1))}
...@@ -214,7 +214,7 @@ const Home = () => { ...@@ -214,7 +214,7 @@ const Home = () => {
swiperRef.current?.slideTo(toIndex) swiperRef.current?.slideTo(toIndex)
}} }}
/> />
</div> */} </div>
</div> </div>
</div> </div>
</div> </div>
......
This diff is collapsed.
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