Want a function that:
- 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.
Want a function that:
OIOContext.zoomOIOContext.zoomis a decimal number between0and1OIOContext.zoom !== 1We want to apply a zoom calculation if and only if:
Also need to account for:
border: 1px solid redpadding: 10px 20px 30px 40pxpadding: 30px 40pxpadding: 40pxCurrently 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:
100pxis passed to the function, and there is a zoom of0.5, we assume it will return50px(includes the unit)50pxand NOT a csscalcvalue, ie:calc(100px * 0.5). This allows more flexibility with the value that is returned.