@@ -3,6 +3,7 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';
33import { IconButton } from '~/components/ui/IconButton' ;
44import { workbenchStore } from '~/lib/stores/workbench' ;
55import { PortDropdown } from './PortDropdown' ;
6+ import { ScreenshotSelector } from './ScreenshotSelector' ;
67
78type ResizeSide = 'left' | 'right' | null ;
89
@@ -20,6 +21,7 @@ export const Preview = memo(() => {
2021
2122 const [ url , setUrl ] = useState ( '' ) ;
2223 const [ iframeUrl , setIframeUrl ] = useState < string | undefined > ( ) ;
24+ const [ isSelectionMode , setIsSelectionMode ] = useState ( false ) ;
2325
2426 // Toggle between responsive mode and device mode
2527 const [ isDeviceModeOn , setIsDeviceModeOn ] = useState ( false ) ;
@@ -218,12 +220,17 @@ export const Preview = memo(() => {
218220 ) }
219221 < div className = "bg-bolt-elements-background-depth-2 p-2 flex items-center gap-1.5" >
220222 < IconButton icon = "i-ph:arrow-clockwise" onClick = { reloadPreview } />
221-
223+ < IconButton
224+ icon = "i-ph:selection"
225+ onClick = { ( ) => setIsSelectionMode ( ! isSelectionMode ) }
226+ className = { isSelectionMode ? 'bg-bolt-elements-background-depth-3' : '' }
227+ />
222228 < div
223229 className = "flex items-center gap-1 flex-grow bg-bolt-elements-preview-addressBar-background border border-bolt-elements-borderColor text-bolt-elements-preview-addressBar-text rounded-full px-3 py-1 text-sm hover:bg-bolt-elements-preview-addressBar-backgroundHover hover:focus-within:bg-bolt-elements-preview-addressBar-backgroundActive focus-within:bg-bolt-elements-preview-addressBar-backgroundActive
224230 focus-within-border-bolt-elements-borderColorActive focus-within:text-bolt-elements-preview-addressBar-textActive"
225231 >
226232 < input
233+ title = "URL"
227234 ref = { inputRef }
228235 className = "w-full bg-transparent outline-none"
229236 type = "text"
@@ -281,7 +288,20 @@ export const Preview = memo(() => {
281288 } }
282289 >
283290 { activePreview ? (
284- < iframe ref = { iframeRef } className = "border-none w-full h-full bg-white" src = { iframeUrl } allowFullScreen />
291+ < >
292+ < iframe
293+ ref = { iframeRef }
294+ title = "preview"
295+ className = "border-none w-full h-full bg-white"
296+ src = { iframeUrl }
297+ allowFullScreen
298+ />
299+ < ScreenshotSelector
300+ isSelectionMode = { isSelectionMode }
301+ setIsSelectionMode = { setIsSelectionMode }
302+ containerRef = { iframeRef }
303+ />
304+ </ >
285305 ) : (
286306 < div className = "flex w-full h-full justify-center items-center bg-white" > No preview available</ div >
287307 ) }
0 commit comments