import * as React from "react"; import { Component } from 'react'; import { styleSheet } from '../../StyleSheet'; const styles = styleSheet(require('./ShadowedScrollBox.module.scss')); const Inner = styles.element(['inner']); const Outer = styles.element(['outer', 'shadowed-scroll']); const Overlay = styles.element(['overlay']); const HiderTop = styles.element(['hider-top']); const HiderBottom = styles.element(['hider-bottom']); type HeightMode = 'flex' | 'watched'; export const HeightModeContext = React.createContext('flex'); export class ShadowedScroll extends Component<{ inner?: React.HTMLProps, outer?: React.HTMLProps }> { static contextType = HeightModeContext; context: React.ContextType static readonly stylesheet = styles; render() { const { outer: outerProps = {}, inner: innerProps = {}, children } = this.props; if (this.context == 'watched') { return
} // Using a CSS background approach is simpler and smoother, but renders below any contained objects const useCSSBackground = false; if (useCSSBackground) { return {children} } else { return {children} } } }