@@ -11,13 +11,22 @@ import type { Atom } from 'nanostores';
11
11
import { atom , effect } from 'nanostores' ;
12
12
import type { Logger } from 'roarr' ;
13
13
14
- // Theme-consistent spacing constants (in pixels)
15
- const SPACING_2 = 8 ; // Equivalent to theme token 2
16
- const SPACING_4 = 16 ; // Equivalent to theme token 4
17
- const SPACING_8 = 32 ; // Equivalent to theme token 8
18
- const BORDER_RADIUS_BASE = 6 ; // Equivalent to theme borderRadius "base"
14
+ // To get pixel sizes corresponding to our theme tokens, first find the theme token CSS var in browser dev tools.
15
+ // For example `var(--invoke-space-8)` is equivalent to using `8` as a space prop in a component.
16
+ //
17
+ // If it is already in pixels, you can use it directly. If it is in rems, you need to convert it to pixels.
18
+ //
19
+ // For example:
20
+ // const style = window.getComputedStyle(document.documentElement)
21
+ // parseFloat(style.fontSize) * parseFloat(style.getPropertyValue("--invoke-space-8"))
22
+ //
23
+ // This will give you the pixel value for the theme token in pixels.
24
+ const SPACING_2 = 6 ; // Equivalent to theme token 2
25
+ const SPACING_4 = 12 ; // Equivalent to theme token 4
26
+ const SPACING_8 = 24 ; // Equivalent to theme token 8
27
+ const BORDER_RADIUS_BASE = 4 ; // Equivalent to theme borderRadius "base"
19
28
const BORDER_WIDTH = 1 ; // Standard border width
20
- const FONT_SIZE_SM = 14 ; // Equivalent to theme fontSize "sm"
29
+ const FONT_SIZE_SM = 12 ; // Equivalent to theme fontSize "sm"
21
30
const BADGE_MIN_WIDTH = 200 ;
22
31
const BADGE_HEIGHT = 36 ;
23
32
0 commit comments