@@ -8,10 +8,13 @@ import { IsolatedCanvas } from "components/canvas";
88import { PreviewAndRunPanel } from "components/preview-and-run" ;
99import { useEditorState } from "core/states" ;
1010import { useTargetContainer } from "hooks" ;
11+ import { Dialog } from "@material-ui/core" ;
12+ import { FullScreenPreview } from "scaffolds/preview-full-screen" ;
1113
1214export function IsolateModeCanvas ( { onClose } : { onClose : ( ) => void } ) {
1315 const [ state ] = useEditorState ( ) ;
1416 const [ preview , setPreview ] = useState < Result > ( ) ;
17+ const [ fullscreen , setFullscreen ] = useState ( false ) ;
1518
1619 const { target, root } = useTargetContainer ( ) ;
1720
@@ -69,30 +72,49 @@ export function IsolateModeCanvas({ onClose }: { onClose: () => void }) {
6972 } , [ target ?. id ] ) ;
7073
7174 return (
72- < IsolatedCanvas
73- key = { target ?. id }
74- onExit = { onClose }
75- defaultSize = { {
76- width : target ?. width ?? 375 ,
77- height : target ?. height ?? 812 ,
78- } }
79- >
80- { preview ? (
81- < VanillaRunner
82- key = { preview . scaffold . raw }
83- style = { {
84- borderRadius : 4 ,
85- boxShadow : "0px 0px 48px #00000020" ,
75+ < >
76+ < Dialog
77+ fullScreen
78+ onClose = { ( ) => {
79+ setFullscreen ( false ) ;
80+ } }
81+ open = { fullscreen }
82+ >
83+ < FullScreenPreview
84+ onClose = { ( ) => {
85+ setFullscreen ( false ) ;
8686 } }
87- source = { preview . scaffold . raw }
88- width = "100%"
89- height = "100%"
90- componentName = { preview . name }
9187 />
92- ) : (
93- < EditorCanvasSkeleton />
94- ) }
95- </ IsolatedCanvas >
88+ </ Dialog >
89+
90+ < IsolatedCanvas
91+ key = { target ?. id }
92+ onExit = { onClose }
93+ onFullscreen = { ( ) => {
94+ setFullscreen ( true ) ;
95+ } }
96+ defaultSize = { {
97+ width : target ?. width ?? 375 ,
98+ height : target ?. height ?? 812 ,
99+ } }
100+ >
101+ { preview ? (
102+ < VanillaRunner
103+ key = { preview . scaffold . raw }
104+ style = { {
105+ borderRadius : 4 ,
106+ boxShadow : "0px 0px 48px #00000020" ,
107+ } }
108+ source = { preview . scaffold . raw }
109+ width = "100%"
110+ height = "100%"
111+ componentName = { preview . name }
112+ />
113+ ) : (
114+ < EditorCanvasSkeleton />
115+ ) }
116+ </ IsolatedCanvas >
117+ </ >
96118 ) ;
97119}
98120
0 commit comments