projectionPeriodControl.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import styled from '@emotion/styled';
  2. import RadioGroup from 'sentry/components/forms/controls/radioGroup';
  3. import {Tooltip} from 'sentry/components/tooltip';
  4. import {t} from 'sentry/locale';
  5. import {space} from 'sentry/styles/space';
  6. import type {ProjectionSamplePeriod} from 'sentry/views/settings/dynamicSampling/utils/useProjectSampleCounts';
  7. interface Props {
  8. onChange: (period: ProjectionSamplePeriod) => void;
  9. period: ProjectionSamplePeriod;
  10. }
  11. export function ProjectionPeriodControl({period, onChange}: Props) {
  12. return (
  13. <Wrapper>
  14. <Tooltip
  15. showUnderline
  16. title={t('The time period for which the estimated sample rates are calculated.')}
  17. >
  18. {t('Project the next')}
  19. </Tooltip>
  20. <StyledRadioGroup
  21. orientInline
  22. label={t('Project the next')}
  23. value={period}
  24. onChange={onChange}
  25. choices={[
  26. ['24h', t('24h')],
  27. ['30d', t('30d')],
  28. ]}
  29. />
  30. </Wrapper>
  31. );
  32. }
  33. const Wrapper = styled('label')`
  34. display: flex;
  35. align-items: center;
  36. gap: ${space(1)};
  37. margin-bottom: 0;
  38. `;
  39. const StyledRadioGroup = styled(RadioGroup<ProjectionSamplePeriod>)`
  40. gap: ${space(1)};
  41. `;