repository.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import styled from '@emotion/styled';
  2. import PanelItem from 'sentry/components/panels/panelItem';
  3. import {space} from 'sentry/styles/space';
  4. import type {CustomRepo} from 'sentry/types/debugFiles';
  5. import CustomRepositoryActions from './actions';
  6. import {customRepoTypeLabel} from './utils';
  7. type Props = {
  8. hasAccess: boolean;
  9. hasFeature: boolean;
  10. onDelete: (repositoryId: string) => void;
  11. onEdit: (repositoryId: string) => void;
  12. repository: CustomRepo;
  13. };
  14. function Repository({repository, onDelete, onEdit, hasFeature, hasAccess}: Props) {
  15. const {id, name, type} = repository;
  16. return (
  17. <StyledPanelItem>
  18. <Name>{name}</Name>
  19. <TypeAndStatus>{customRepoTypeLabel[type]}</TypeAndStatus>
  20. <CustomRepositoryActions
  21. repositoryName={name}
  22. hasFeature={hasFeature}
  23. hasAccess={hasAccess}
  24. onDelete={() => onDelete(id)}
  25. onEdit={() => onEdit(id)}
  26. />
  27. </StyledPanelItem>
  28. );
  29. }
  30. export default Repository;
  31. const StyledPanelItem = styled(PanelItem)`
  32. display: grid;
  33. align-items: flex-start;
  34. gap: ${space(1)};
  35. grid-template-columns: max-content 1fr;
  36. @media (min-width: ${p => p.theme.breakpoints.small}) {
  37. grid-template-columns: max-content 1fr max-content;
  38. }
  39. `;
  40. const Name = styled('div')`
  41. grid-column: 2/2;
  42. @media (min-width: ${p => p.theme.breakpoints.small}) {
  43. grid-column: 2/3;
  44. grid-row: 1/2;
  45. }
  46. `;
  47. const TypeAndStatus = styled('div')`
  48. color: ${p => p.theme.gray300};
  49. font-size: ${p => p.theme.fontSizeMedium};
  50. display: flex;
  51. flex-wrap: wrap;
  52. align-items: center;
  53. grid-column: 2/2;
  54. gap: ${space(1.5)};
  55. @media (min-width: ${p => p.theme.breakpoints.small}) {
  56. grid-column: 2/3;
  57. grid-row: 2/2;
  58. gap: ${space(1)};
  59. }
  60. `;