index.tsx 822 B

123456789101112131415161718192021222324252627282930313233343536
  1. import clsx from "clsx";
  2. import React from "react";
  3. import styles from "./index.module.scss";
  4. interface Props {
  5. text?: string;
  6. render?: React.ReactNode;
  7. img?: string;
  8. type?: "auto" | "full";
  9. className?: string;
  10. iconClassName?: string;
  11. }
  12. const Empty: React.FC<Props> = ({
  13. text = "no data",
  14. render,
  15. img = "/empty.webp",
  16. type = "auto",
  17. className,
  18. iconClassName,
  19. }) => {
  20. return (
  21. <div className={clsx(styles.empty, className, { [styles.full]: type === "full" })}>
  22. {!render && (
  23. <div className={clsx(styles.icon, iconClassName)}>
  24. <img src={img} alt="" />
  25. </div>
  26. )}
  27. {render}
  28. <div className={styles.text}>{text}</div>
  29. </div>
  30. );
  31. };
  32. export default Empty;