// @flow import 'scss/component/_swipeable-drawer.scss'; // $FlowFixMe import { Global } from '@emotion/react'; // $FlowFixMe import { grey } from '@mui/material/colors'; import { HEADER_HEIGHT_MOBILE } from 'component/fileRenderMobile/view'; import { SwipeableDrawer as MUIDrawer } from '@mui/material'; import * as ICONS from 'constants/icons'; import * as React from 'react'; import Button from 'component/button'; const DRAWER_PULLER_HEIGHT = 42; type Props = { children: Node, open: boolean, theme: string, mobilePlayerDimensions?: { height: number }, title: any, actions?: any, toggleDrawer: () => void, }; export default function SwipeableDrawer(props: Props) { const { mobilePlayerDimensions, title, children, open, theme, actions, toggleDrawer } = props; const [coverHeight, setCoverHeight] = React.useState(); const videoHeight = coverHeight || (mobilePlayerDimensions ? mobilePlayerDimensions.height : 0); React.useEffect(() => { if (open && !mobilePlayerDimensions && !coverHeight) { const element = document.querySelector(`.file-page__video-container`); if (element) { const rect = element.getBoundingClientRect(); setCoverHeight(rect.height); } } }, [coverHeight, mobilePlayerDimensions, open]); const DrawerGlobalStyles = () => ( .MuiPaper-root': { overflow: 'visible', color: 'var(--color-text)', position: 'absolute', height: `calc(100% - ${DRAWER_PULLER_HEIGHT}px)`, }, }} /> ); return ( <> {open && (
)} {children}
); } type PullerProps = { theme: string, }; const Puller = (pullerProps: PullerProps) => { const { theme } = pullerProps; return ( ); }; type HeaderProps = { title: any, actions?: any, toggleDrawer: () => void, }; const HeaderContents = (headerProps: HeaderProps) => { const { title, actions, toggleDrawer } = headerProps; return (
{title}
{actions}
); }; type ExpandButtonProps = { label: any, toggleDrawer: () => void, }; export const DrawerExpandButton = (expandButtonProps: ExpandButtonProps) => { const { label, toggleDrawer } = expandButtonProps; return (