groupEventAttachmentsTable.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import styled from '@emotion/styled';
  2. import {PanelTable} from 'sentry/components/panels/panelTable';
  3. import {t} from 'sentry/locale';
  4. import {space} from 'sentry/styles/space';
  5. import type {IssueAttachment} from 'sentry/types/group';
  6. import GroupEventAttachmentsTableRow from 'sentry/views/issueDetails/groupEventAttachments/groupEventAttachmentsTableRow';
  7. type Props = {
  8. attachments: IssueAttachment[];
  9. emptyMessage: string;
  10. groupId: string;
  11. isLoading: boolean;
  12. onDelete: (attachment: IssueAttachment) => void;
  13. projectSlug: string;
  14. };
  15. function GroupEventAttachmentsTable({
  16. isLoading,
  17. attachments,
  18. projectSlug,
  19. groupId,
  20. emptyMessage,
  21. onDelete,
  22. }: Props) {
  23. return (
  24. <AttachmentsPanelTable
  25. isLoading={isLoading}
  26. isEmpty={attachments.length === 0}
  27. emptyMessage={emptyMessage}
  28. headers={[t('Name'), t('Type'), t('Size'), t('Actions')]}
  29. >
  30. {attachments.map(attachment => (
  31. <GroupEventAttachmentsTableRow
  32. key={attachment.id}
  33. attachment={attachment}
  34. projectSlug={projectSlug}
  35. groupId={groupId}
  36. onDelete={onDelete}
  37. />
  38. ))}
  39. </AttachmentsPanelTable>
  40. );
  41. }
  42. export default GroupEventAttachmentsTable;
  43. const AttachmentsPanelTable = styled(PanelTable)`
  44. grid-template-columns: 1fr repeat(3, min-content);
  45. margin-bottom: 0;
  46. & > :last-child {
  47. padding: ${p => (p.isEmpty ? space(4) : undefined)};
  48. }
  49. .preview {
  50. padding: 0;
  51. }
  52. .preview-open {
  53. border-bottom: none;
  54. }
  55. `;