This repository has been archived by the owner on Apr 25, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: auto fetch more items in dashboard page , project list , dataset…
… page for big screens (#255) * Auto fetch more * Update src/components/molecules/Settings/SettingPage/index.tsx Co-authored-by: KaWaite <34051327+KaWaite@users.noreply.github.com> * Update src/components/molecules/Common/AssetModal/AssetContainer/index.tsx Co-authored-by: KaWaite <34051327+KaWaite@users.noreply.github.com> * Update src/components/molecules/Common/AssetModal/AssetContainer/index.tsx Co-authored-by: KaWaite <34051327+KaWaite@users.noreply.github.com> * pr-fixes2 * pr-fixes3 * Update src/util/infinite-scroll.ts Co-authored-by: KaWaite <34051327+KaWaite@users.noreply.github.com> * Update src/components/molecules/Dashboard/index.tsx Co-authored-by: KaWaite <34051327+KaWaite@users.noreply.github.com> * pr-fix2 Co-authored-by: nina992 <nouralali992@gmail.com> Co-authored-by: KaWaite <34051327+KaWaite@users.noreply.github.com>
- Loading branch information
1 parent
fd46316
commit fb8bf98
Showing
5 changed files
with
53 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { MutableRefObject } from "react"; | ||
|
||
export function autoFillPage( | ||
ref: MutableRefObject<HTMLDivElement | undefined | null>, | ||
onLoadMore?: () => void, | ||
) { | ||
if (ref.current && ref.current?.scrollHeight <= document.documentElement.clientHeight) { | ||
onLoadMore?.(); | ||
} | ||
} | ||
|
||
export function onScrollToBottom( | ||
{ currentTarget }: React.UIEvent<HTMLDivElement, UIEvent>, | ||
onLoadMore?: () => void, | ||
threshold = 5, | ||
) { | ||
if ( | ||
currentTarget.scrollTop + currentTarget.clientHeight >= | ||
currentTarget.scrollHeight - threshold | ||
) { | ||
onLoadMore?.(); | ||
} | ||
} |