progress.tsx 625 B

123456789101112131415161718192021222324252627282930
  1. import {CSSProperties} from 'react';
  2. import styled from '@emotion/styled';
  3. /**
  4. * A simple progress bar.
  5. * ```
  6. * <Meter>
  7. * <Value percent={0.75} />
  8. * </Meter>
  9. * ```
  10. *
  11. * Extend the components to set a background color.
  12. *
  13. * Return multiple <Value /> components to render multiple bars directly on top
  14. * of each other with `position:absolute;`.
  15. */
  16. export const Meter = styled('div')`
  17. position: relative;
  18. height: 100%;
  19. width: 100%;
  20. pointer-events: none;
  21. `;
  22. export const Value = styled('span')<{
  23. style: {width: string} & CSSProperties;
  24. }>`
  25. position: absolute;
  26. height: 100%;
  27. pointer-events: none;
  28. `;