11import type { ScopedThreadRef } from "@t3tools/contracts" ;
22import { MinusIcon , PlusIcon , XIcon } from "lucide-react" ;
33import { useRef , useState } from "react" ;
4+ import { useNativeTitlebarHeight } from "~/lib/windowControlsOverlay" ;
45
56import { HtmlRenderDocument } from "../files/BrowserDocumentFrame" ;
67import { Button } from "../ui/button" ;
@@ -13,6 +14,7 @@ export function HtmlRenderDialog(props: {
1314 readonly onClose : ( ) => void ;
1415} ) {
1516 const [ zoom , setZoom ] = useState ( 1 ) ;
17+ const titlebarHeight = useNativeTitlebarHeight ( ) ;
1618 const closeButtonRef = useRef < HTMLButtonElement > ( null ) ;
1719 return (
1820 < Dialog open onOpenChange = { ( open ) => ! open && props . onClose ( ) } >
@@ -21,6 +23,7 @@ export function HtmlRenderDialog(props: {
2123 showCloseButton = { false }
2224 bottomStickOnMobile = { false }
2325 className = "row-start-1"
26+ style = { { marginTop : titlebarHeight } }
2427 initialFocus = { closeButtonRef }
2528 >
2629 < DialogTitle className = "sr-only" > Expanded { props . title } preview</ DialogTitle >
@@ -35,7 +38,10 @@ export function HtmlRenderDialog(props: {
3538 >
3639 < XIcon />
3740 </ Button >
38- < div className = "h-[min(86vh,calc(100vh-160px))] overflow-auto overscroll-contain rounded-lg bg-background shadow-2xl ring-1 ring-border/70 [container-type:size]" >
41+ < div
42+ className = "h-[min(86vh,calc(100vh-160px))] overflow-auto overscroll-contain rounded-lg bg-background shadow-2xl ring-1 ring-border/70 [container-type:size]"
43+ style = { { maxHeight : `calc(100vh - 160px - ${ titlebarHeight } px)` } }
44+ >
3945 < div className = "h-[100cqh] w-[100cqw]" style = { { zoom } } >
4046 < HtmlRenderDocument
4147 src = { props . src }
0 commit comments