mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-25 03:16:37 -05:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
18 lines
406 B
TypeScript
18 lines
406 B
TypeScript
export const getPixelHeight = (varname: string) => {
|
|
// Create a temporary element
|
|
const el = document.createElement('div')
|
|
el.style.cssText = `
|
|
position: absolute;
|
|
bottom: 0;
|
|
height: env(${varname});
|
|
visibility: hidden;
|
|
`
|
|
document.body.appendChild(el)
|
|
|
|
// Measure the computed pixel value
|
|
const value = parseFloat(getComputedStyle(el).height)
|
|
el.remove()
|
|
|
|
return value
|
|
}
|