import { Focusable, SteamSpinner } from '@decky/ui'; import { FunctionComponent, ReactElement, ReactNode, Suspense } from 'react'; interface WithSuspenseProps { children: ReactNode; route?: boolean; } // Nice little wrapper around Suspense so we don't have to duplicate the styles and code for the loading spinner const WithSuspense: FunctionComponent = (props) => { const propsCopy = { ...props }; delete propsCopy.children; (props.children as ReactElement)?.props && Object.assign((props.children as ReactElement).props, propsCopy); // There is probably a better way to do this but valve does it this way so ¯\_(ツ)_/¯ return ( {}} style={{ overflowY: 'scroll', backgroundColor: 'transparent', ...(props.route && { marginTop: '40px', height: 'calc( 100% - 40px )', }), }} > } > {props.children} ); }; export default WithSuspense;