UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

23 lines (22 loc) 952 B
import * as React from 'react'; import { Box } from 'rebass'; import NotifyResize from '../NotifyResize'; const SizedContainer = (props) => { const { onResize: onResizeFromProps, ...domProps } = props; const [size, onResize] = React.useState(null); const sizeFn = props.children; return (React.createElement(Box, { ...domProps, style: { flex: 1, ...domProps.style, position: 'relative' } }, React.createElement(Box, { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', }, "data-width": size ? size.width : null, "data-height": size ? size.height : null }, React.createElement(NotifyResize, { onResize: (size) => { onResize(size); onResizeFromProps?.(size); } }), size ? sizeFn(size) : null))); }; export default SizedContainer;