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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { Button } from '@mui/material';
  2. import CircularProgress from '@mui/material/CircularProgress';
  3. import Image from 'next/image';
  4. const LoadMore = ({ fetchNextPage, isFetchingNextPage, hasNextPage }) => {
  5. return (
  6. <Button
  7. onClick={fetchNextPage}
  8. startIcon={
  9. !isFetchingNextPage && (
  10. <Image
  11. src="/images/arrow.svg"
  12. alt="arrow down"
  13. width={29}
  14. height={29}
  15. />
  16. )
  17. }
  18. sx={{
  19. backgroundColor: 'primary.main',
  20. height: 50,
  21. width: 150,
  22. color: 'white',
  23. ':hover': {
  24. bgcolor: 'primary.main',
  25. color: 'white',
  26. },
  27. }}
  28. >
  29. {isFetchingNextPage && (
  30. <CircularProgress
  31. style={{
  32. color: '#fff',
  33. width: '29px',
  34. height: '29px',
  35. marginRight: '20px',
  36. }}
  37. />
  38. )}
  39. {isFetchingNextPage
  40. ? 'Loading...'
  41. : hasNextPage
  42. ? 'Load More'
  43. : 'Nothing more to load'}
  44. </Button>
  45. );
  46. };
  47. export default LoadMore;