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.

57 lines
1.7 KiB

  1. "use client";
  2. import React, { FC } from "react";
  3. import twFocusClass from "@/utils/twFocusClass";
  4. export interface NextPrevProps {
  5. className?: string;
  6. currentPage?: number;
  7. totalPage?: number;
  8. btnClassName?: string;
  9. onClickNext?: () => void;
  10. onClickPrev?: () => void;
  11. onlyNext?: boolean;
  12. onlyPrev?: boolean;
  13. }
  14. const NextPrev: FC<NextPrevProps> = ({
  15. className = "",
  16. onClickNext = () => {},
  17. onClickPrev = () => {},
  18. btnClassName = "w-10 h-10",
  19. onlyNext = false,
  20. onlyPrev = false,
  21. }) => {
  22. return (
  23. <div
  24. className={`nc-NextPrev relative flex items-center text-neutral-900 dark:text-neutral-300 ${className}`}
  25. data-nc-id="NextPrev"
  26. data-glide-el="controls"
  27. >
  28. {!onlyNext && (
  29. <button
  30. className={`${btnClassName} ${
  31. !onlyPrev ? "mr-[6px]" : ""
  32. } bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-6000 dark:hover:border-neutral-500 rounded-full flex items-center justify-center hover:border-neutral-300 ${twFocusClass()}`}
  33. onClick={onClickPrev}
  34. title="Prev"
  35. data-glide-dir="<"
  36. >
  37. <i className="las la-angle-left"></i>
  38. </button>
  39. )}
  40. {!onlyPrev && (
  41. <button
  42. className={`${btnClassName} bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-6000 dark:hover:border-neutral-500 rounded-full flex items-center justify-center hover:border-neutral-300 ${twFocusClass()}`}
  43. onClick={onClickNext}
  44. title="Next"
  45. data-glide-dir=">"
  46. >
  47. <i className="las la-angle-right"></i>
  48. </button>
  49. )}
  50. </div>
  51. );
  52. };
  53. export default NextPrev;