emptyStateWarning.tsx 1.4 KB

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