space.tsx 295 B

123456789101112131415161718
  1. const SPACES = {
  2. 0.25: '2px',
  3. 0.5: '4px',
  4. 0.75: '6px',
  5. 1: '8px',
  6. 1.5: '12px',
  7. 2: '16px',
  8. 3: '20px',
  9. 4: '30px',
  10. } as const;
  11. export type ValidSize = keyof typeof SPACES;
  12. function space<S extends ValidSize>(size: S): (typeof SPACES)[S] {
  13. return SPACES[size];
  14. }
  15. export {space};