emptyStateWarning.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import styled from '@emotion/styled';
  2. import {IconSearch} from 'sentry/icons';
  3. import space from 'sentry/styles/space';
  4. import EmptyMessage from 'sentry/views/settings/components/emptyMessage';
  5. type Props = {
  6. children?: React.ReactNode;
  7. className?: string;
  8. small?: boolean;
  9. withIcon?: boolean;
  10. };
  11. const EmptyStateWarning = ({
  12. small = false,
  13. withIcon = true,
  14. children,
  15. className,
  16. }: Props) =>
  17. small ? (
  18. <EmptyMessage className={className}>
  19. <SmallMessage>
  20. {withIcon && <StyledIconSearch color="gray300" size="lg" />}
  21. {children}
  22. </SmallMessage>
  23. </EmptyMessage>
  24. ) : (
  25. <EmptyStreamWrapper data-test-id="empty-state" className={className}>
  26. {withIcon && <IconSearch size="54px" />}
  27. {children}
  28. </EmptyStreamWrapper>
  29. );
  30. const EmptyStreamWrapper = styled('div')`
  31. text-align: center;
  32. font-size: 22px;
  33. padding: ${space(4)} ${space(2)};
  34. p {
  35. line-height: 1.2;
  36. margin: 0 auto 20px;
  37. &:last-child {
  38. margin-bottom: 0;
  39. }
  40. }
  41. svg {
  42. fill: ${p => p.theme.gray200};
  43. margin-bottom: ${space(2)};
  44. }
  45. `;
  46. const SmallMessage = styled('div')`
  47. display: flex;
  48. align-items: center;
  49. color: ${p => p.theme.gray300};
  50. font-size: ${p => p.theme.fontSizeExtraLarge};
  51. line-height: 1em;
  52. `;
  53. const StyledIconSearch = styled(IconSearch)`
  54. margin-right: ${space(1)};
  55. `;
  56. export default EmptyStateWarning;