import React from 'react' import { ScreenType } from '@designable/core' import { requestIdle } from '@designable/shared' import { observer } from '@formily/reactive-react' import { useScreen } from '../hooks' import { MobileSimulator, PCSimulator, ResponsiveSimulator, } from '../simulators' export type ISimulatorProps = React.HTMLAttributes export const Simulator: React.FC = observer( (props: ISimulatorProps) => { const screen = useScreen() if (screen.type === ScreenType.PC) return {props.children} if (screen.type === ScreenType.Mobile) return {props.children} if (screen.type === ScreenType.Responsive) return ( {props.children} ) return {props.children} }, { scheduler: requestIdle, } )