deploys.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import styled from '@emotion/styled';
  2. import DeployBadge from 'sentry/components/deployBadge';
  3. import SidebarSection from 'sentry/components/sidebarSection';
  4. import TextOverflow from 'sentry/components/textOverflow';
  5. import TimeSince from 'sentry/components/timeSince';
  6. import {t} from 'sentry/locale';
  7. import space from 'sentry/styles/space';
  8. import {Deploy} from 'sentry/types';
  9. type Props = {
  10. deploys: Deploy[];
  11. orgSlug: string;
  12. projectId: number;
  13. version: string;
  14. };
  15. const Deploys = ({version, orgSlug, projectId, deploys}: Props) => {
  16. return (
  17. <SidebarSection title={t('Deploys')}>
  18. {deploys.map(deploy => (
  19. <Row key={deploy.id}>
  20. <StyledDeployBadge
  21. deploy={deploy}
  22. orgSlug={orgSlug}
  23. version={version}
  24. projectId={projectId}
  25. />
  26. <TextOverflow>
  27. <TimeSince date={deploy.dateFinished} />
  28. </TextOverflow>
  29. </Row>
  30. ))}
  31. </SidebarSection>
  32. );
  33. };
  34. const Row = styled('div')`
  35. display: flex;
  36. align-items: center;
  37. justify-content: space-between;
  38. margin-bottom: ${space(1)};
  39. font-size: ${p => p.theme.fontSizeMedium};
  40. color: ${p => p.theme.subText};
  41. `;
  42. const StyledDeployBadge = styled(DeployBadge)`
  43. margin-right: ${space(1)};
  44. `;
  45. export default Deploys;