import { cn } from '@/lib/utils';
import { t } from 'i18next';
import { useIsDarkTheme } from '../theme-provider';
import { Plus } from 'lucide-react';
import { useMemo } from 'react';
import SvgIcon from '../svg-icon';
import { EmptyCardData, EmptyCardType, EmptyType } from './constant';
import { EmptyCardProps, EmptyProps } from './interface';
const EmptyIcon = ({ name, width }: { name: string; width?: number }) => {
return (
//
);
};
const Empty = (props: EmptyProps) => {
const { className, children, type, text, iconWidth } = props;
const isDarkTheme = useIsDarkTheme();
const name = useMemo(() => {
return isDarkTheme
? `empty/no-${type || EmptyType.Data}-dark`
: `empty/no-${type || EmptyType.Data}-bri`;
}, [isDarkTheme, type]);
return (
{!children && (
{text ||
(type === 'data' ? t('common.noData') : t('common.noResults'))}
)}
{children}
);
};
export default Empty;
export const EmptyCard = (props: EmptyCardProps) => {
const { icon, className, children, title, description, style } = props;
return (
{icon}
{title &&
{title}
}
{description && (
{description}
)}
{children}
);
};
export const EmptyAppCard = (props: {
type: EmptyCardType;
onClick?: () => void;
showIcon?: boolean;
className?: string;
size?: 'small' | 'large';
}) => {
const { type, showIcon, className } = props;
let defaultClass = '';
let style = {};
switch (props.size) {
case 'small':
style = { width: '256px' };
defaultClass = 'mt-1';
break;
case 'large':
style = { width: '480px' };
defaultClass = 'mt-5';
break;
default:
defaultClass = '';
break;
}
return (
);
};