@@ -5,8 +5,10 @@ export const extendTheme = (theme, extension) => mergeDeepRight(theme, extension
55
66export const propOrElse = ( pathName , defaultValue ) => props => pathOr ( defaultValue , pathName , props )
77
8- export const getOrElse = ( pathName , defaultValue ) => ( { theme } ) =>
9- pathOr ( defaultValue , pathName , theme )
8+ export const getOrElse =
9+ ( pathName , defaultValue ) =>
10+ ( { theme } ) =>
11+ pathOr ( defaultValue , pathName , theme )
1012
1113export const getSizeUnit = ( { theme } ) => path ( [ "constants" , "SIZE_UNIT" ] , theme )
1214
@@ -20,7 +22,7 @@ export const calcSize = expr => props => {
2022
2123export const getColor = colorPath => {
2224 const colorPaths = Array . isArray ( colorPath ) ? colorPath : [ colorPath ]
23- return getOrElse ( [ "colors" , ...colorPaths ] , "#fff" )
25+ return getOrElse ( [ "colors" , ...colorPaths ] , colorPath || "#fff" )
2426}
2527
2628export const getRgbColor = ( colorPath , opacity = 1 ) => {
@@ -35,22 +37,23 @@ export const getRgbColor = (colorPath, opacity = 1) => {
3537 }
3638}
3739
38- export const getSizeBy = ( multiplier = 1 ) => props => {
39- const size = ( getSizeUnit ( props ) || 0 ) * multiplier
40- return `${ size } px`
41- }
40+ export const getSizeBy =
41+ ( multiplier = 1 ) =>
42+ props => {
43+ const size = ( getSizeUnit ( props ) || 0 ) * multiplier
44+ return `${ size } px`
45+ }
4246
4347export const getGutterHeight = ( { theme } ) => {
4448 const gutterValue = path ( [ "constants" , "GUTTER_HEIGHT" ] , theme ) || 0
4549 return `${ gutterValue } px`
4650}
4751
48- export const getValidatedControlColor = (
49- defaultColorPath = "border" ,
50- defaultDisabledPath = "disabled"
51- ) => ( { theme, success, error, disabled } ) => {
52- if ( success ) return getColor ( [ "success" ] ) ( { theme } )
53- if ( error ) return getColor ( [ "error" ] ) ( { theme } )
54- if ( disabled ) return getColor ( [ defaultDisabledPath ] ) ( { theme } )
55- return getColor ( [ defaultColorPath ] ) ( { theme } )
56- }
52+ export const getValidatedControlColor =
53+ ( defaultColorPath = "border" , defaultDisabledPath = "disabled" ) =>
54+ ( { theme, success, error, disabled } ) => {
55+ if ( success ) return getColor ( [ "success" ] ) ( { theme } )
56+ if ( error ) return getColor ( [ "error" ] ) ( { theme } )
57+ if ( disabled ) return getColor ( [ defaultDisabledPath ] ) ( { theme } )
58+ return getColor ( [ defaultColorPath ] ) ( { theme } )
59+ }
0 commit comments