repository.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. return (
  16. <StyledPanelItem>
  17. <div>
  18. <div>{repository.name}</div>
  19. <TypeAndStatus>{customRepoTypeLabel[repository.type]}</TypeAndStatus>
  20. </div>
  21. <div>
  22. <CustomRepositoryActions
  23. repositoryName={repository.name}
  24. hasFeature={hasFeature}
  25. hasAccess={hasAccess}
  26. onDelete={() => onDelete(repository.id)}
  27. onEdit={() => onEdit(repository.id)}
  28. />
  29. </div>
  30. </StyledPanelItem>
  31. );
  32. }
  33. export default Repository;
  34. const StyledPanelItem = styled(PanelItem)`
  35. display: flex;
  36. align-items: center;
  37. justify-content: space-between;
  38. gap: ${space(1)};
  39. `;
  40. const TypeAndStatus = styled('div')`
  41. color: ${p => p.theme.gray300};
  42. font-size: ${p => p.theme.fontSizeMedium};
  43. display: flex;
  44. flex-wrap: wrap;
  45. align-items: center;
  46. `;