import { FiCornerDownRight } from 'react-icons/fi'; import { MdSwapVert } from 'react-icons/md'; import { DomainError } from '../../../vis/models'; import styles from './DomainTooltip.module.css'; const ERRORS = { [DomainError.MinGreater]: { message: 'Min greater than max', fallback: 'data range', }, [DomainError.InvalidMinWithScale]: { message: 'Custom min invalid with this scale', fallback: 'data min', }, [DomainError.InvalidMaxWithScale]: { message: 'Custom max invalid with this scale', fallback: 'data max', }, [DomainError.CustomMaxFallback]: { message: 'Custom min invalid with this scale', fallback: 'custom max', }, }; interface Props { error: DomainError; showSwapBtn?: boolean; onSwap?: () => void; } function ErrorMessage(props: Props) { const { error, showSwapBtn = false, onSwap } = props; const { message, fallback } = ERRORS[error]; return (

{message}
falling back to {fallback}
{showSwapBtn && onSwap && ( )}

); } export default ErrorMessage;