import clsx from "clsx";
import React from "react";
import styles from "./index.module.scss";

interface Props {
    text?: string;
    render?: React.ReactNode;
    img?: string;
    type?: "auto" | "full";
    className?: string;
    iconClassName?: string;
}

const Empty: React.FC<Props> = ({
    text = "no data",
    render,
    img = "/empty.webp",
    type = "auto",
    className,
    iconClassName,
}) => {
    return (
        <div className={clsx(styles.empty, className, { [styles.full]: type === "full" })}>
            {!render && (
                <div className={clsx(styles.icon, iconClassName)}>
                    <img src={img} alt="" />
                </div>
            )}

            {render}
            <div className={styles.text}>{text}</div>
        </div>
    );
};

export default Empty;
