Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

LoadMore.tsx 1.6KB

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