transparentLoadingMask.tsx 726 B

1234567891011121314151617181920212223242526
  1. import styled from '@emotion/styled';
  2. import LoadingMask, {LoadingMaskProps} from 'sentry/components/loadingMask';
  3. interface TransparentLoadingMaskProps extends LoadingMaskProps {
  4. visible: boolean;
  5. children?: React.ReactNode;
  6. className?: string;
  7. }
  8. const TransparentLoadingMask = styled(
  9. ({className, visible, children, ...props}: TransparentLoadingMaskProps) => {
  10. const other = visible ? {...props, 'data-test-id': 'loading-placeholder'} : props;
  11. return (
  12. <LoadingMask className={className} {...other}>
  13. {children}
  14. </LoadingMask>
  15. );
  16. }
  17. )<TransparentLoadingMaskProps>`
  18. ${p => !p.visible && 'display: none;'};
  19. opacity: 0.4;
  20. z-index: 1;
  21. `;
  22. export default TransparentLoadingMask;