All files / src/components/ErrorMessageBanner ErrorMessageBanner.tsx

100% Statements 9/9
100% Branches 0/0
100% Functions 3/3
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 275x 5x 5x   16x 17x 16x   16x             6x   6x                  
import React from 'react';
import { Banner, ErrorBanner } from '@procore/core-react';
import { useToaster } from 'react-hot-toast/headless';
 
export function ErrorMessageBanner() {
  const { toasts, handlers } = useToaster();
  const { startPause, endPause } = handlers;
 
  return (
    <div
      onMouseEnter={startPause}
      onMouseLeave={endPause}
      style={{ marginBottom: 12 }}
    >
      {toasts
        .filter((toast) => toast.visible)
        .map((toast) => (
          <ErrorBanner key={toast.id} style={{ marginBottom: 8 }}>
            <Banner.Content>
              <Banner.Body>{toast.message as string}</Banner.Body>
            </Banner.Content>
          </ErrorBanner>
        ))}
    </div>
  );
}