import { useOverlayScroller } from '@gpustack/core-ui'; import React, { useCallback } from 'react'; import styled from 'styled-components'; import { WrapperContext } from './use-wrapper-context'; const Wrapper = styled.div` flex: 1; display: flex; flex-direction: column; justify-content: space-between; position: relative; width: 100%; `; const ContentWrapper = styled.div` flex: 1; position: relative; overflow-y: auto; `; const Footer = styled.div` padding-block: 0; background-color: var(--ant-color-bg-elevated); `; interface ColumnWrapperProps { children: React.ReactNode; footer?: React.ReactNode; maxHeight?: string | number; paddingBottom?: number; styles?: { wrapper?: React.CSSProperties; container?: React.CSSProperties; }; } const ColumnWrapper: React.FC = ({ children, footer, maxHeight, styles = {} }) => { const scroller = React.useRef(null); const footerRef = React.useRef(null); const contentRef = React.useRef(null); const { initialize, instance, scrollEventElement, scrollToBottom, scrollToTarget, getScrollElementScrollableHeight } = useOverlayScroller({ options: { scrollbars: { autoHide: 'move' } } }); React.useEffect(() => { if (scroller.current) { initialize(scroller.current); } }, []); const setContentPaddingBottom = useCallback((padding: number) => { contentRef.current!.style.paddingBottom = `${padding}px`; }, []); return (
{children}
{footer && }
); }; export default ColumnWrapper;