import React, { ReactElement } from 'react'; import cn from 'classnames'; import { RefreshSvg } from '../../icons'; import './Placeholder.scss'; interface PlaceholderProps { icon?: ReactElement; text: string | string[]; onRetry?: VoidFunction; className?: string; } export default function Placeholder({ icon, text, onRetry, className, }: PlaceholderProps) { const renderText = (content: string, index?: number) => ( {content} ); return (
{icon &&
{icon}
} {Array.isArray(text) ? text.map(renderText) : renderText(text)} {onRetry && (
Retry
)}
); }