Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99508157
getThemeValue.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 25, 02:14
Size
1 KB
Mime Type
text/x-java
Expires
Mon, Jan 27, 02:14 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23808785
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
getThemeValue.js
View Options
import
borders
from
'./borders'
;
import
display
from
'./display'
;
import
flexbox
from
'./flexbox'
;
import
grid
from
'./cssGrid'
;
import
positions
from
'./positions'
;
import
palette
from
'./palette'
;
import
shadows
from
'./shadows'
;
import
sizing
from
'./sizing'
;
import
spacing
from
'./spacing'
;
import
typography
from
'./typography'
;
const
filterPropsMapping
=
{
borders
:
borders
.
filterProps
,
display
:
display
.
filterProps
,
flexbox
:
flexbox
.
filterProps
,
grid
:
grid
.
filterProps
,
positions
:
positions
.
filterProps
,
palette
:
palette
.
filterProps
,
shadows
:
shadows
.
filterProps
,
sizing
:
sizing
.
filterProps
,
spacing
:
spacing
.
filterProps
,
typography
:
typography
.
filterProps
};
export
const
styleFunctionMapping
=
{
borders
,
display
,
flexbox
,
grid
,
positions
,
palette
,
shadows
,
sizing
,
spacing
,
typography
};
export
const
propToStyleFunction
=
Object
.
keys
(
filterPropsMapping
).
reduce
((
acc
,
styleFnName
)
=>
{
filterPropsMapping
[
styleFnName
].
forEach
(
propName
=>
{
acc
[
propName
]
=
styleFunctionMapping
[
styleFnName
];
});
return
acc
;
},
{});
function
getThemeValue
(
prop
,
value
,
theme
)
{
const
inputProps
=
{
[
prop
]
:
value
,
theme
};
const
styleFunction
=
propToStyleFunction
[
prop
];
return
styleFunction
?
styleFunction
(
inputProps
)
:
{
[
prop
]
:
value
};
}
export
default
getThemeValue
;
Event Timeline
Log In to Comment