similarSpectrum.tsx 833 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import styled from '@emotion/styled';
  2. import {t} from 'sentry/locale';
  3. type Props = {
  4. className?: string;
  5. };
  6. const BaseSimilarSpectrum = ({className}: Props) => (
  7. <div className={className}>
  8. <span>{t('Similar')}</span>
  9. <SpectrumItem colorIndex={4} />
  10. <SpectrumItem colorIndex={3} />
  11. <SpectrumItem colorIndex={2} />
  12. <SpectrumItem colorIndex={1} />
  13. <SpectrumItem colorIndex={0} />
  14. <span>{t('Not Similar')}</span>
  15. </div>
  16. );
  17. const SimilarSpectrum = styled(BaseSimilarSpectrum)`
  18. display: flex;
  19. font-size: ${p => p.theme.fontSizeSmall};
  20. `;
  21. type ItemProps = {
  22. colorIndex: number;
  23. };
  24. const SpectrumItem = styled('span')<ItemProps>`
  25. border-radius: 2px;
  26. margin: 5px;
  27. width: 14px;
  28. ${p => `background-color: ${p.theme.similarity.colors[p.colorIndex]};`};
  29. `;
  30. export default SimilarSpectrum;