@@ -17,14 +17,15 @@ const OPEN_DELAY_MS = 300
1717const TRIGGER_EXIT_GRACE_MS = 600
1818const CONTENT_EXIT_GRACE_MS = 120
1919const CODE_TOOLTIP_MAX_HEIGHT_PX = 256
20+ const CODE_TOOLTIP_MAX_WIDTH = 'min(480px, calc(100vw - 2rem))'
2021
2122interface CodeHoverCardProps {
2223 preview : CodePreview
2324 className : string
2425 children : ReactNode
2526}
2627
27- /** Interactive, two-axis- scrollable source preview anchored to a canvas code chip. */
28+ /** Interactive, vertically scrollable source preview anchored to a canvas code chip. */
2829export function CodeHoverCard ( { preview, className, children } : CodeHoverCardProps ) {
2930 const [ open , setOpen ] = useState ( false )
3031 const contentId = useId ( )
@@ -164,6 +165,7 @@ export function CodeHoverCard({ preview, className, children }: CodeHoverCardPro
164165 collisionPadding = { 16 }
165166 appearance = 'tooltip'
166167 maxHeight = { CODE_TOOLTIP_MAX_HEIGHT_PX }
168+ maxWidth = { CODE_TOOLTIP_MAX_WIDTH }
167169 onPointerEnter = { clearCloseTimer }
168170 onPointerLeave = { ( ) => scheduleClose ( CONTENT_EXIT_GRACE_MS ) }
169171 onFocus = { clearCloseTimer }
@@ -174,9 +176,12 @@ export function CodeHoverCard({ preview, className, children }: CodeHoverCardPro
174176 < Code . Viewer
175177 code = { preview . code }
176178 language = { preview . language }
179+ showGutter
180+ wrapText
177181 density = 'compact'
182+ paddingLeft = { 8 }
178183 highlightWorkflowReferences
179- className = 'max-h-[min(16rem,calc(100vh-2rem))] min-h-0 rounded-none border-0 bg-[var(--bg)] shadow-none dark:bg-[var(--bg)]'
184+ className = 'max-h-[min(16rem,calc(100vh-2rem))] min-h-0 overflow-x-hidden rounded-none border-0 bg-[var(--bg)] shadow-none dark:bg-[var(--bg)]'
180185 />
181186 </ PopoverContent >
182187 </ Popover >
0 commit comments