Skip to content

Commit

Permalink
refactor: better naming on flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelbr committed Dec 2, 2024
1 parent d6bee61 commit a098d7a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/sections/employees/EmployeeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function EmployeeList({
useState<ChewbaccaEmployee[]>(employees);

const {
isShowMore,
showShowMoreButton,
isShowMorePending,
limitedEmployees,
showMoreHandler,
Expand Down Expand Up @@ -172,7 +172,7 @@ export default function EmployeeList({
</div>
{isShowMorePending && <EmployeeListSkeleton />}

{(!isShowMore || isShowMorePending) && (
{showShowMoreButton && (
<ShowMoreButton
showMoreHandler={showMoreHandler}
showMoreHref={showMoreHref}
Expand Down Expand Up @@ -235,7 +235,8 @@ function useShowAll(filteredEmployees: ChewbaccaEmployee[]) {
limitedEmployees,
showMoreHandler,
isShowMorePending: isPending,
isShowMore: !limitEmployees,
showShowMoreButton:
limitEmployees && !isPending && filteredEmployees.length > DEFAULT_LIMIT,
showMoreHref: `${currentPath}?showAll`,
};
}
Expand Down

0 comments on commit a098d7a

Please sign in to comment.