modal.tsx 910 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. function Modal({
  13. title,
  14. onSave,
  15. content,
  16. disabled,
  17. Header,
  18. Body,
  19. Footer,
  20. closeModal,
  21. }: Props) {
  22. return (
  23. <Fragment>
  24. <Header closeButton>
  25. <h5>{title}</h5>
  26. </Header>
  27. <Body>{content}</Body>
  28. <Footer>
  29. <ButtonBar gap={1.5}>
  30. <Button onClick={closeModal}>{t('Cancel')}</Button>
  31. <Button onClick={onSave} disabled={disabled} priority="primary">
  32. {t('Save Rule')}
  33. </Button>
  34. </ButtonBar>
  35. </Footer>
  36. </Fragment>
  37. );
  38. }
  39. export default Modal;