The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/components/GenericTable/hooks/useShowingResultsLabel.ts

15 lines
647 B

import { Pagination } from '@rocket.chat/fuselage';
import { ComponentProps, useCallback } from 'react';
import { useTranslation } from '../../../contexts/TranslationContext';
type Props<T extends ComponentProps<typeof Pagination>['showingResultsLabel'] = ComponentProps<typeof Pagination>['showingResultsLabel']> =
T extends (...args: any[]) => any ? Parameters<T> : never;
export const useShowingResultsLabel = (): ((...params: Props) => string) => {
const t = useTranslation();
return useCallback(
({ count, current, itemsPerPage }) => t('Showing_results_of', current + 1, Math.min(current + itemsPerPage, count), count),
[t],
);
};