progressHeader.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import {css, useTheme} from '@emotion/react';
  2. import styled from '@emotion/styled';
  3. import ProgressRing from 'sentry/components/progressRing';
  4. import {t} from 'sentry/locale';
  5. import space from 'sentry/styles/space';
  6. import {OnboardingTaskDescriptor, OnboardingTaskStatus} from 'sentry/types';
  7. type Props = {
  8. allTasks: OnboardingTaskDescriptor[];
  9. completedTasks: OnboardingTaskStatus[];
  10. };
  11. function ProgressHeader({allTasks, completedTasks}: Props) {
  12. const theme = useTheme();
  13. return (
  14. <Container>
  15. <StyledProgressRing
  16. size={80}
  17. barWidth={8}
  18. text={allTasks.length - completedTasks.length}
  19. animateText
  20. value={(completedTasks.length / allTasks.length) * 100}
  21. progressEndcaps="round"
  22. backgroundColor={theme.gray100}
  23. textCss={() => css`
  24. font-size: 26px;
  25. color: ${theme.textColor};
  26. `}
  27. />
  28. <HeaderTitle>{t('Quick Start')}</HeaderTitle>
  29. <Description>
  30. {t('Walk through this guide to get the most out of Sentry right away.')}
  31. </Description>
  32. </Container>
  33. );
  34. }
  35. export default ProgressHeader;
  36. const Container = styled('div')`
  37. display: grid;
  38. grid-template-columns: min-content 1fr;
  39. grid-template-rows: min-content 1fr;
  40. grid-column-gap: ${space(2)};
  41. margin: 90px ${space(4)} 0 ${space(4)};
  42. `;
  43. const StyledProgressRing = styled(ProgressRing)`
  44. grid-column: 1/2;
  45. grid-row: 1/3;
  46. `;
  47. const HeaderTitle = styled('h3')`
  48. margin: 0;
  49. grid-column: 2/3;
  50. grid-row: 1/2;
  51. `;
  52. const Description = styled('div')`
  53. color: ${p => p.theme.gray300};
  54. grid-column: 2/3;
  55. grid-row: 2/3;
  56. `;