-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Want a function that:
- You pass a desired prop and it returns a value that has been multiplied by the
OIOContext.zoom OIOContext.zoomis a decimal number between0and1- 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
100pxis passed to the function, and there is a zoom of0.5, we assume it will return50px(includes the unit) - As an addition to the above note, we would prefer to return
50pxand NOT a csscalcvalue, ie:calc(100px * 0.5). This allows more flexibility with the value that is returned.
Metadata
Metadata
Assignees
Labels
No labels