index.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import {css} from '@emotion/react';
  2. import styled from '@emotion/styled';
  3. import Feature from 'sentry/components/acl/feature';
  4. import FeatureDisabled from 'sentry/components/acl/featureDisabled';
  5. import * as Layout from 'sentry/components/layouts/thirds';
  6. import {t} from 'sentry/locale';
  7. import {space} from 'sentry/styles/space';
  8. import type {Group} from 'sentry/types/group';
  9. import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
  10. import useOrganization from 'sentry/utils/useOrganization';
  11. import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';
  12. import GroupEventAttachments from './groupEventAttachments';
  13. type Props = RouteComponentProps<{groupId: string}, {}> & {
  14. group: Group;
  15. };
  16. function GroupEventAttachmentsContainer({group}: Props) {
  17. const organization = useOrganization();
  18. const hasStreamlinedUI = useHasStreamlinedUI();
  19. return (
  20. <Feature
  21. features="event-attachments"
  22. organization={organization}
  23. renderDisabled={props => (
  24. <FeatureDisabled {...props} featureName={t('Event Attachments')} />
  25. )}
  26. >
  27. <StyledLayoutBody hasStreamlinedUI={hasStreamlinedUI}>
  28. <Layout.Main fullWidth>
  29. <GroupEventAttachments project={group.project} groupId={group.id} />
  30. </Layout.Main>
  31. </StyledLayoutBody>
  32. </Feature>
  33. );
  34. }
  35. const StyledLayoutBody = styled(Layout.Body)<{hasStreamlinedUI?: boolean}>`
  36. ${p =>
  37. p.hasStreamlinedUI &&
  38. css`
  39. border: 1px solid ${p.theme.border};
  40. border-radius: ${p.theme.borderRadius};
  41. padding: ${space(2)} 0;
  42. @media (min-width: ${p.theme.breakpoints.medium}) {
  43. padding: ${space(2)} ${space(2)};
  44. }
  45. `}
  46. `;
  47. export default GroupEventAttachmentsContainer;