errorPanel.tsx 914 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import styled from '@emotion/styled';
  2. import {IconWarning} from 'sentry/icons';
  3. import {space} from 'sentry/styles/space';
  4. import {DEEMPHASIS_COLOR_NAME} from 'sentry/views/dashboards/widgets/bigNumberWidget/settings';
  5. import type {StateProps} from 'sentry/views/dashboards/widgets/common/types';
  6. interface ErrorPanelProps {
  7. error: StateProps['error'];
  8. }
  9. export function ErrorPanel({error}: ErrorPanelProps) {
  10. return (
  11. <Panel>
  12. <NonShrinkingWarningIcon color={DEEMPHASIS_COLOR_NAME} size="md" />
  13. <span>{error?.toString()}</span>
  14. </Panel>
  15. );
  16. }
  17. const NonShrinkingWarningIcon = styled(IconWarning)`
  18. flex-shrink: 0;
  19. `;
  20. const Panel = styled('div')<{height?: string}>`
  21. position: absolute;
  22. inset: 0;
  23. padding: ${space(0.5)} 0;
  24. display: flex;
  25. gap: ${space(1)};
  26. overflow: hidden;
  27. color: ${p => p.theme[DEEMPHASIS_COLOR_NAME]};
  28. font-size: ${p => p.theme.fontSizeLarge};
  29. `;