UNPKG

@chayns-components/core

Version:

A set of beautiful React components for developing your own applications with chayns.

39 lines 943 B
import { getWindowMetrics, useWindowMetrics } from 'chayns-api'; export const getUsableHeight = async () => { let usableHeight; const { bottomBarHeight, offsetTop, windowHeight } = await getWindowMetrics(); usableHeight = windowHeight; if (bottomBarHeight) { usableHeight -= bottomBarHeight; } if (offsetTop) { usableHeight -= offsetTop; } return usableHeight; }; export const useUsableHeight = ({ shouldReduceByCoverHeight } = {}) => { let usableHeight; const { bottomBarHeight, offsetTop, topBarHeight, windowHeight } = useWindowMetrics(); usableHeight = windowHeight; if (bottomBarHeight) { usableHeight -= bottomBarHeight; } if (!shouldReduceByCoverHeight && topBarHeight) { usableHeight -= topBarHeight; } else if (shouldReduceByCoverHeight && offsetTop) { usableHeight -= offsetTop; } return usableHeight; }; //# sourceMappingURL=pageProvider.js.map