modal.tsx 868 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {Fragment} from 'react';
  2. import {ModalRenderProps} from 'sentry/actionCreators/modal';
  3. import Button from 'sentry/components/button';
  4. import ButtonBar from 'sentry/components/buttonBar';
  5. import {t} from 'sentry/locale';
  6. type Props = {
  7. content: React.ReactElement;
  8. disabled: boolean;
  9. onSave: () => void;
  10. title: string;
  11. } & ModalRenderProps;
  12. const Modal = ({
  13. title,
  14. onSave,
  15. content,
  16. disabled,
  17. Header,
  18. Body,
  19. Footer,
  20. closeModal,
  21. }: Props) => (
  22. <Fragment>
  23. <Header closeButton>
  24. <h5>{title}</h5>
  25. </Header>
  26. <Body>{content}</Body>
  27. <Footer>
  28. <ButtonBar gap={1.5}>
  29. <Button onClick={closeModal}>{t('Cancel')}</Button>
  30. <Button onClick={onSave} disabled={disabled} priority="primary">
  31. {t('Save Rule')}
  32. </Button>
  33. </ButtonBar>
  34. </Footer>
  35. </Fragment>
  36. );
  37. export default Modal;