@onvo-ai/react
Version:
The react SDK for Onvo AI dashboard builder
18 lines (15 loc) • 490 B
text/typescript
import { useDashboard } from "../layouts/Dashboard/useDashboard";
export const useMaxHeight = () => {
let { widgets, tab } = useDashboard();
let h_lg = 0;
let h_sm = 0;
widgets.filter(a => a.tab === tab).forEach((i: any) => {
if (i.layouts.lg?.y + i.layouts.lg?.h > h_lg) {
h_lg = i.layouts.lg?.y + i.layouts.lg?.h;
}
if (i.layouts.sm?.y + i.layouts.sm?.h > h_sm) {
h_sm = i.layouts.sm?.y + i.layouts.sm?.h;
}
});
return { lg: h_lg, sm: h_sm };
};