emptyStateWarning.tsx 1.4 KB

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