Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andreadelrio committed Apr 6, 2022
1 parent 1435c12 commit 0f97f0b
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ interface FieldTypeTableItem {
description: string;
}

const FIELD_TYPES_PER_PAGE = 6;

/**
* Component is Discover's side bar to search of available fields
* Additionally there's a button displayed that allows the user to show/hide more filter fields
Expand Down Expand Up @@ -109,20 +107,15 @@ export function DiscoverFieldSearch({ onChange, value, types, presentFieldTypes

const { docLinks } = useDiscoverServices();

const { curPageIndex, pageSize, totalPages, startIndex, changePageIndex } = usePager({
initialPageSize: FIELD_TYPES_PER_PAGE,
totalItems: presentFieldTypes.length,
});
const items: FieldTypeTableItem[] = useMemo(() => {
return presentFieldTypes
.sort((one, another) => one.localeCompare(another))
.map((element, index) => ({
id: index,
dataType: element,
description: getFieldTypeDescription(element),
}))
.slice(startIndex, pageSize + startIndex);
}, [pageSize, presentFieldTypes, startIndex]);
}));
}, [presentFieldTypes]);

const onHelpClick = () => setIsHelpOpen((prevIsHelpOpen) => !prevIsHelpOpen);
const closeHelp = () => setIsHelpOpen(false);
Expand Down

0 comments on commit 0f97f0b

Please sign in to comment.