From 8b4752c0e6b53428d98e6e70aed56e402bb01b47 Mon Sep 17 00:00:00 2001 From: YaroslavLys <74725159+YaroslavLys@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:57:51 +0300 Subject: [PATCH] Implemented sorting categories in popular categories block (#2030) --- src/components/popular-categories/PopularCategories.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/popular-categories/PopularCategories.tsx b/src/components/popular-categories/PopularCategories.tsx index 06e156160..96b5ce67f 100644 --- a/src/components/popular-categories/PopularCategories.tsx +++ b/src/components/popular-categories/PopularCategories.tsx @@ -21,7 +21,7 @@ import { getScreenBasedLimit, spliceSx } from '~/utils/helper-functions' -import { CategoryInterface, ItemsWithCount } from '~/types' +import { CategoryInterface, ItemsWithCount, SortEnum } from '~/types' import { styles } from '~/components/popular-categories/PopularCategories.styles' interface PopularCategoriesProps { @@ -43,7 +43,11 @@ const PopularCategories: FC = ({ const itemsToShow = getScreenBasedLimit(breakpoints, itemsLoadLimit) const getCategories = useCallback( - () => categoryService.getCategories({ limit: itemsToShow }), + () => + categoryService.getCategories({ + limit: itemsToShow, + sort: { order: SortEnum.Desc, orderBy: 'totalOffersSum' } + }), [itemsToShow] ) const { response, loading } = useAxios>({