panelAlert.tsx 854 B

123456789101112131415161718192021222324252627282930313233
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import Alert from 'app/components/alert';
  4. import {IconCheckmark, IconClose, IconFlag, IconInfo} from 'app/icons';
  5. import space from 'app/styles/space';
  6. type Props = React.ComponentProps<typeof Alert>;
  7. const DEFAULT_ICONS = {
  8. info: <IconInfo size="md" />,
  9. error: <IconClose isCircled size="md" />,
  10. warning: <IconFlag size="md" />,
  11. success: <IconCheckmark isCircled size="md" />,
  12. };
  13. // Margin bottom should probably be a different prop
  14. const PanelAlert = styled(({icon, ...props}: Props) => (
  15. <Alert {...props} icon={icon || DEFAULT_ICONS[props.type!]} system />
  16. ))`
  17. margin: 0 0 1px 0;
  18. padding: ${space(2)};
  19. border-radius: 0;
  20. box-shadow: none;
  21. &:last-child {
  22. border-bottom: none;
  23. margin: 0;
  24. border-radius: 0 0 4px 4px;
  25. }
  26. `;
  27. export default PanelAlert;