import Link from 'next/link' import { Icons, ResponsiveImage, Skeleton } from 'components' import { truncate } from 'utils' import { useGetProductsQuery } from '@/store/services' const BestSellsSlider = props => { //? Props const { categorySlug } = props const { products, isLoading } = useGetProductsQuery( { sort: 2, category: categorySlug, page_size: 15, }, { selectFromResult: ({ data, isLoading }) => ({ products: data?.data?.products, isLoading, }), } ) //? Render(s) return (

最畅销商品

{isLoading ? Array(12) .fill('_') .map((_, index) => ( )) : products?.map((item, index) => (
{index + 1} {truncate(item.title, 40)}
))}
) } export default BestSellsSlider