Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99459874
sizing.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, Jan 24, 18:39
Size
1 KB
Mime Type
text/x-java
Expires
Sun, Jan 26, 18:39 (1 d, 18 h)
Engine
blob
Format
Raw Data
Handle
23797617
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
sizing.js
View Options
import
style
from
'./style'
;
import
compose
from
'./compose'
;
import
{
handleBreakpoints
,
values
as
breakpointsValues
}
from
'./breakpoints'
;
export
function
sizingTransform
(
value
)
{
return
value
<=
1
&&
value
!==
0
?
`
$
{
value
*
100
}
%
`
:
value
;
}
export
const
width
=
style
({
prop
:
'width'
,
transform
:
sizingTransform
});
export
const
maxWidth
=
props
=>
{
if
(
props
.
maxWidth
!==
undefined
&&
props
.
maxWidth
!==
null
)
{
const
styleFromPropValue
=
propValue
=>
{
const
breakpoint
=
props
.
theme
?
.
breakpoints
?
.
values
?
.[
propValue
]
||
breakpointsValues
[
propValue
];
return
{
maxWidth
:
breakpoint
||
sizingTransform
(
propValue
)
};
};
return
handleBreakpoints
(
props
,
props
.
maxWidth
,
styleFromPropValue
);
}
return
null
;
};
maxWidth
.
filterProps
=
[
'maxWidth'
];
export
const
minWidth
=
style
({
prop
:
'minWidth'
,
transform
:
sizingTransform
});
export
const
height
=
style
({
prop
:
'height'
,
transform
:
sizingTransform
});
export
const
maxHeight
=
style
({
prop
:
'maxHeight'
,
transform
:
sizingTransform
});
export
const
minHeight
=
style
({
prop
:
'minHeight'
,
transform
:
sizingTransform
});
export
const
sizeWidth
=
style
({
prop
:
'size'
,
cssProperty
:
'width'
,
transform
:
sizingTransform
});
export
const
sizeHeight
=
style
({
prop
:
'size'
,
cssProperty
:
'height'
,
transform
:
sizingTransform
});
export
const
boxSizing
=
style
({
prop
:
'boxSizing'
});
const
sizing
=
compose
(
width
,
maxWidth
,
minWidth
,
height
,
maxHeight
,
minHeight
,
boxSizing
);
export
default
sizing
;
Event Timeline
Log In to Comment