@hypothesis/frontend-shared
Version:
Shared components, styles and utilities for Hypothesis projects
35 lines • 1.11 kB
JavaScript
var _jsxFileName = "/home/runner/work/frontend-shared/frontend-shared/src/components/data/ScrollContainer.tsx";
import classnames from 'classnames';
import { downcastRef } from '../../util/typing';
import { jsxDEV as _jsxDEV } from "preact/jsx-dev-runtime";
/**
* Constrain children (which may include both scrollable and non-scrolling
* content) to the dimensions of the immediate parent.
*/
export default function ScrollContainer({
children,
classes,
elementRef,
borderless = false,
rounded = false,
...htmlAttributes
}) {
return _jsxDEV("div", {
"data-component": "ScrollContainer",
...htmlAttributes,
ref: downcastRef(elementRef),
className: classnames('flex flex-col h-full w-full',
// Prevent overflow by overriding `min-height: auto`.
// See https://stackoverflow.com/a/66689926/434243.
'min-h-0', {
border: !borderless,
'rounded-lg overflow-hidden': rounded
}, classes),
children: children
}, void 0, false, {
fileName: _jsxFileName,
lineNumber: 29,
columnNumber: 5
}, this);
}
//# sourceMappingURL=ScrollContainer.js.map