You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You pass a desired prop and it returns a value that has been multiplied by the OIOContext.zoom
OIOContext.zoom is a decimal number between 0 and 1
Function checks that that prop (and importantly, that prop at that breakpoint) exists
Checks that the OIOContext.zoom !== 1
We want to apply a zoom calculation if and only if:
The prop is not: 0, auto, undefined, null, etc
The prop does not include a unit in %
The prop includes unit: px, vh, vw,
Also need to account for:
example: border: 1px solid red
example: padding: 10px 20px 30px 40px
example: padding: 30px 40px
example: padding: 40px
Currently would say out of scope to consider units: em, rem, cm, mm, in, pt, pc
Example Usage const width = applyScale(props.width, breakpoint)
Other Notes:
We may want to assume that passing a breakpoint is optional (meaning that the prop being passed is not from a OIOResponsiveString)
Just for clarity: If the value 100px is passed to the function, and there is a zoom of 0.5, we assume it will return 50px (includes the unit)
As an addition to the above note, we would prefer to return 50px and NOT a css calc value, ie: calc(100px * 0.5). This allows more flexibility with the value that is returned.
The text was updated successfully, but these errors were encountered:
Want a function that:
OIOContext.zoom
OIOContext.zoom
is a decimal number between0
and1
OIOContext.zoom !== 1
We want to apply a zoom calculation if and only if:
Also need to account for:
border: 1px solid red
padding: 10px 20px 30px 40px
padding: 30px 40px
padding: 40px
Currently would say out of scope to consider units: em, rem, cm, mm, in, pt, pc
Example Usage
const width = applyScale(props.width, breakpoint)
Other Notes:
100px
is passed to the function, and there is a zoom of0.5
, we assume it will return50px
(includes the unit)50px
and NOT a csscalc
value, ie:calc(100px * 0.5)
. This allows more flexibility with the value that is returned.The text was updated successfully, but these errors were encountered: