imageViewer.tsx 771 B

1234567891011121314151617181920212223242526272829
  1. import styled from '@emotion/styled';
  2. import {
  3. getAttachmentUrl,
  4. ViewerProps,
  5. } from 'sentry/components/events/attachmentViewers/utils';
  6. import {PanelItem} from 'sentry/components/panels';
  7. type Props = Omit<ViewerProps, 'attachment'> & {
  8. attachment: Omit<ViewerProps['attachment'], 'event_id'> & {
  9. event_id?: string;
  10. };
  11. onError?: React.ReactEventHandler<HTMLImageElement>;
  12. onLoad?: React.ReactEventHandler<HTMLImageElement>;
  13. };
  14. function ImageViewer({className, onLoad, onError, ...props}: Props) {
  15. return (
  16. <Container className={className}>
  17. <img src={getAttachmentUrl(props, true)} onLoad={onLoad} onError={onError} />
  18. </Container>
  19. );
  20. }
  21. export default ImageViewer;
  22. const Container = styled(PanelItem)`
  23. justify-content: center;
  24. `;