File tree 1 file changed +6
-16
lines changed
1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change 1
- import { isNum , isStr , fallbackTo } from '@exah/utils'
1
+ import { isNum , fallbackTo , identity } from '@exah/utils'
2
+
2
3
import {
3
4
boolValue ,
4
5
createSpaceValue ,
@@ -60,26 +61,15 @@ const gridItem = createStyles({
60
61
}
61
62
} )
62
63
63
- const getNumericValueAndUnits = ( value , step ) => {
64
- const [ numericValue = 0 , units = 'px' ] =
65
- value == null
66
- ? isStr ( step )
67
- ? splitUnit ( step )
68
- : [ 0 , 'px' ]
69
- : isNum ( value )
70
- ? [ value , 'px' ]
71
- : splitUnit ( value )
72
- return [ numericValue , units ]
73
- }
74
-
75
64
const getItemsSpaceStyles = ( axis , {
76
65
childSelector,
77
66
rowSelector
78
67
} ) => style ( {
79
- getValue : createSpaceValue ( ) ( ) ,
68
+ getValue : createSpaceValue ( ) ( sizeValue ( identity ) ) ,
80
69
getStyle ( value , step , props ) {
81
- const [ numericValue , units ] = getNumericValueAndUnits ( value , step )
82
- const size = `${ numericValue / 2 } ${ units } `
70
+ const [ num , unit ] = splitUnit ( value )
71
+ const size = `${ num / 2 } ${ unit || 'px' } `
72
+
83
73
return {
84
74
...( axis . x && {
85
75
marginLeft : `-${ size } ` ,
You can’t perform that action at this time.
0 commit comments