-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
load more and group notifications instead of pagination
- Loading branch information
1 parent
29a1dfe
commit be97689
Showing
5 changed files
with
150 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import Button from './Primitives/Button'; | ||
|
||
const LoadMoreButton = ({ | ||
total, | ||
pageSize, | ||
currentCount, | ||
onLoadMore, | ||
loading | ||
}) => { | ||
const hasMore = currentCount < total; | ||
|
||
if (!hasMore) return null; | ||
|
||
return ( | ||
<div className="flex justify-center mt-2 pb-12 md:pb-4"> | ||
<Button | ||
onClick={onLoadMore} | ||
disabled={loading} | ||
className={`!rounded-full ${ | ||
loading ? 'opacity-50 cursor-not-allowed' : '' | ||
}`} | ||
> | ||
{loading ? 'Loading...' : 'Load more'} | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoadMoreButton; |
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 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