File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
packages/system/src/styles Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ export const getSpace = themeGetter({
13
13
transform : ( _ , { rawValue, variants } ) => {
14
14
if ( string ( rawValue ) ) {
15
15
const neg = rawValue . startsWith ( '-' )
16
- const variantKey = neg ? rawValue . substr ( 1 ) : rawValue
17
- const variantValue = variants [ variantKey ]
18
- const value = is ( variantValue ) ? variantValue : rawValue
16
+ const absoluteValue = neg ? rawValue . substr ( 1 ) : rawValue
17
+ const variantValue = variants [ absoluteValue ]
18
+ const value = is ( variantValue ) ? variantValue : absoluteValue
19
19
return pxUnit ( neg ? toNegative ( value ) : value )
20
20
}
21
21
const abs = Math . abs ( rawValue )
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ describe('#getSpace', () => {
25
25
const props = { theme : { space : { md : 10 } } }
26
26
expect ( getSpace ( 'md' ) ( props ) ) . toEqual ( '10px' )
27
27
expect ( getSpace ( '-md' ) ( props ) ) . toEqual ( '-10px' )
28
+ expect ( getSpace ( '-10' ) ( props ) ) . toEqual ( '-10' )
29
+ expect ( getSpace ( '-10px' ) ( props ) ) . toEqual ( '-10px' )
28
30
} )
29
31
} )
30
32
You can’t perform that action at this time.
0 commit comments