@hypothesis/frontend-shared
Version:
Shared components, styles and utilities for Hypothesis projects
42 lines (40 loc) • 1.31 kB
JavaScript
var _jsxFileName = "/home/runner/work/frontend-shared/frontend-shared/src/components/data/Scroll.js";
import classnames from 'classnames';
import { downcastRef } from '../../util/typing';
/**
* @typedef {import('../../types').PresentationalProps} CommonProps
* @typedef {import('preact').JSX.HTMLAttributes<HTMLElement>} HTMLAttributes
*
* @typedef ScrollProps
* @prop {'raised'|'flat'} [variant='raised'] - Render with scroll-hinting
* shadows ('raised') or without ('flat')
*/
/**
* Render a fluid container that scrolls on overflow.
*
* @param {CommonProps & ScrollProps & HTMLAttributes} props
*/
import { jsxDEV as _jsxDEV } from "preact/jsx-dev-runtime";
export default function Scroll({
children,
classes,
elementRef,
variant = 'raised',
...htmlAttributes
}) {
return _jsxDEV("div", { ...htmlAttributes,
ref: downcastRef(elementRef),
className: classnames( // Prevent overflow by overriding `min-height: auto`.
// See https://stackoverflow.com/a/66689926/434243.
'min-h-0', 'h-full w-full overflow-auto', {
'scroll-shadows': variant === 'raised'
}, classes),
"data-component": "Scroll",
children: children
}, void 0, false, {
fileName: _jsxFileName,
lineNumber: 29,
columnNumber: 5
}, this);
}
//# sourceMappingURL=Scroll.js.map