fileSize.tsx 507 B

12345678910111213141516171819202122232425
  1. import styled from '@emotion/styled';
  2. import {formatBytesBase2} from 'sentry/utils';
  3. import getDynamicText from 'sentry/utils/getDynamicText';
  4. type Props = {
  5. bytes: number;
  6. className?: string;
  7. };
  8. function FileSize(props: Props) {
  9. const {className, bytes} = props;
  10. return (
  11. <Span className={className}>
  12. {getDynamicText({value: formatBytesBase2(bytes), fixed: 'xx KB'})}
  13. </Span>
  14. );
  15. }
  16. const Span = styled('span')`
  17. font-variant-numeric: tabular-nums;
  18. `;
  19. export default FileSize;