Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F123244630
createUtilityClasses.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
Fri, Jul 25, 23:32
Size
1 KB
Mime Type
text/x-java
Expires
Sun, Jul 27, 23:32 (2 d)
Engine
blob
Format
Raw Data
Handle
27668856
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
createUtilityClasses.js
View Options
import
PropTypes
from
'prop-types'
;
import
{
DEFAULT_BREAKPOINTS
,
DEFAULT_MIN_BREAKPOINT
}
from
'./ThemeProvider'
;
export
function
responsivePropType
(
propType
)
{
return
PropTypes
.
oneOfType
([
propType
,
PropTypes
.
shape
({
xs
:
propType
,
sm
:
propType
,
md
:
propType
,
lg
:
propType
,
xl
:
propType
,
xxl
:
propType
})]);
}
export
default
function
createUtilityClassName
(
utilityValues
,
breakpoints
=
DEFAULT_BREAKPOINTS
,
minBreakpoint
=
DEFAULT_MIN_BREAKPOINT
)
{
const
classes
=
[];
Object
.
entries
(
utilityValues
).
forEach
(([
utilName
,
utilValue
])
=>
{
if
(
utilValue
!=
null
)
{
if
(
typeof
utilValue
===
'object'
)
{
breakpoints
.
forEach
(
brkPoint
=>
{
const
bpValue
=
utilValue
[
brkPoint
];
if
(
bpValue
!=
null
)
{
const
infix
=
brkPoint
!==
minBreakpoint
?
`
-
$
{
brkPoint
}
`
:
''
;
classes
.
push
(
`
$
{
utilName
}
$
{
infix
}
-
$
{
bpValue
}
`
);
}
});
}
else
{
classes
.
push
(
`
$
{
utilName
}
-
$
{
utilValue
}
`
);
}
}
});
return
classes
;
}
Event Timeline
Log In to Comment