shareButton.tsx 849 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {openModal} from 'sentry/actionCreators/modal';
  2. import {Button} from 'sentry/components/button';
  3. import TextCopyInput from 'sentry/components/textCopyInput';
  4. import {IconUpload} from 'sentry/icons';
  5. import {t} from 'sentry/locale';
  6. function ShareModal({Header, Body}: any) {
  7. const url = new URL(window.location.href);
  8. return (
  9. <div>
  10. <Header>
  11. <h3>{t('Share View')}</h3>
  12. </Header>
  13. <Body>
  14. <TextCopyInput aria-label={t('Link to current view')} size="sm">
  15. {url.toString()}
  16. </TextCopyInput>
  17. </Body>
  18. </div>
  19. );
  20. }
  21. function ShareButton() {
  22. return (
  23. <Button
  24. size="sm"
  25. icon={<IconUpload size="sm" />}
  26. onClick={() => {
  27. openModal(deps => <ShareModal {...deps} />);
  28. }}
  29. >
  30. {t('Share')}
  31. </Button>
  32. );
  33. }
  34. export default ShareButton;