import React, { forwardRef } from 'react' import { cn } from '../../services/cn' type ScrollingContainerProps = { /** The content to be shown inside the component. */ children: React.ReactNode /** Height of the container */ height?: number | string /** Optionally hide the top and bottom gradients */ hideGradients?: boolean /** Optionally use `position: absolute` instead of `position: sticky` */ position?: 'absolute' | 'sticky' /** Optional prop to add a test id to the ScrollingContainer for QA testing */ qaTestId?: string } const ScrollingContainer = forwardRef( ( { children, hideGradients, height = 300, position = 'sticky', qaTestId = 'scrolling-container', }, ref, ): React.JSX.Element => { // Gradient styles for top and bottom overlays const gradientClasses = cn( 'z-10 h-4 w-full bg-white', // Base gradient styles // Linear gradient from transparent to white 'bg-gradient-to-t from-transparent to-white', { sticky: position === 'sticky', absolute: position === 'absolute', }, ) return (
{!hideGradients ? (
) : null}
{children}
{!hideGradients ? (
) : null}
) }, ) ScrollingContainer.displayName = 'ScrollingContainer' export default ScrollingContainer