space.tsx 420 B

1234567891011121314151617181920212223
  1. const SPACES = {
  2. 0: '0',
  3. 0.25: '2px',
  4. 0.5: '4px',
  5. 0.75: '6px',
  6. 1: '8px',
  7. 1.5: '12px',
  8. 2: '16px',
  9. 3: '20px',
  10. 4: '30px',
  11. } as const;
  12. export type ValidSize = keyof typeof SPACES;
  13. function space<S extends ValidSize>(size: S): (typeof SPACES)[S] {
  14. return SPACES[size];
  15. }
  16. export {space};
  17. // TODO(epurkhiser): Remove once migrated off it
  18. const DO_NOT_USE_space = space;
  19. export default DO_NOT_USE_space;