space.tsx 309 B

12345678910111213141516171819
  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 default space;