import { ReactNode } from 'react'; import clsx from 'clsx'; import { Loader2 } from 'lucide-react'; import { Icon, IconProps } from '@/react/components/Icon'; import { pluralize } from '@/portainer/helpers/strings'; import { Link } from '@@/Link'; interface Props extends IconProps { type: string; pluralType?: string; // in case the pluralise function isn't suitable isLoading?: boolean; isRefetching?: boolean; value?: number; to?: string; params?: object; children?: ReactNode; dataCy?: string; } export function DashboardItem({ icon, type, pluralType, isLoading, isRefetching, value, to, params, children, dataCy, }: Props) { const Item = (
Refreshing total
Loading total
{typeof value === 'undefined' ? '-' : value}
{pluralize(value || 0, type, pluralType)}
{children}
); if (to) { return ( {Item} ); } return Item; }