import { Box, Container, ScopedCssBaseline } from '@mui/material'; import { styled } from '@mui/material/styles'; import type { PropsWithChildren } from 'react'; import { useWidgetConfig } from '../providers'; import type { WidgetVariant } from '../types'; import { ElementId, createElementId } from '../utils'; export const maxHeight = 680; export const AppExpandedContainer = styled(Box, { shouldForwardProp: (prop) => prop !== 'variant', })<{ variant?: WidgetVariant }>(({ variant }) => ({ display: 'flex', justifyContent: 'center', alignItems: 'middle', flex: 1, height: '100%', })); const RelativeContainer = styled(Box, { shouldForwardProp: (prop) => prop !== 'variant', })<{ variant?: WidgetVariant }>(({ theme, variant }) => ({ position: 'relative', boxSizing: 'content-box', width: '100%', minWidth: 360, maxWidth: 392, maxHeight: variant === 'drawer' ? 'none' : maxHeight, // background: theme.palette.background.default, backgroundColor: '#232323', overflow: 'auto', flex: 1, zIndex: 0, })); const CssBaselineContainer = styled(ScopedCssBaseline, { shouldForwardProp: (prop) => prop !== 'variant', })<{ variant?: WidgetVariant }>(({ variant }) => ({ display: 'flex', flex: 1, flexDirection: 'column', overflowX: 'clip', margin: 0, width: '100%', maxHeight: variant === 'drawer' ? 'none' : maxHeight, overflowY: 'auto', height: '100%', })); export const FlexContainer = styled(Container)({ display: 'flex', flexDirection: 'column', backgroundColor: '#232323', flex: 1, }); export const AppContainer: React.FC> = ({ children }) => { // const ref = useRef(null); const { containerStyle, variant, elementId } = useWidgetConfig(); return ( {children} {/* */} ); }; // export const ScrollToLocation: React.FC<{ // elementRef: RefObject; // }> = ({ elementRef }) => { // const { pathname } = useLocation(); // useLayoutEffect(() => { // elementRef.current?.scrollTo(0, 0); // }, [elementRef, pathname]); // return null; // };