sizes.ts 816 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { css } from '@emotion/react'
  2. import { toPx } from '@/utils/styles'
  3. const base = 4
  4. export function sizes(n: number): string
  5. export function sizes<B extends boolean>(n: number, raw?: B): B extends false ? string : number
  6. export function sizes(n: number, raw?: boolean) {
  7. return raw ? base * n : `${base * n}px`
  8. }
  9. export const zIndex = {
  10. closeBackground: -5,
  11. background: -10,
  12. farBackground: -20,
  13. overlay: 10,
  14. nearOverlay: 20,
  15. transactionBar: 80,
  16. nearTransactionBar: 81,
  17. header: 100,
  18. sideNav: 200,
  19. videoWorkspaceOverlay: 250,
  20. nearVideoWorkspaceOverlay: 260,
  21. globalOverlay: 999,
  22. modals: 1000,
  23. snackbars: 1010,
  24. }
  25. export function square(rawSize: string | number) {
  26. const size = toPx(rawSize)
  27. return css`
  28. width: ${size};
  29. min-width: ${size};
  30. height: ${size};
  31. `
  32. }