@@ -397,6 +397,23 @@ function ProfileHoverTextPopover({ text }: { text: string }) {
397397 ) ;
398398}
399399
400+ /** Popover body for an `image` part: the inline opaque-value thumbnail, enlarged to be legible. */
401+ function EnlargedThumbnailPopover ( { src, alt } : { src : string ; alt ?: string } ) {
402+ return (
403+ < div className = { classNames ( "stepper-popover" , Classes . DARK ) } >
404+ < div className = "stepper-display" >
405+ { alt ? (
406+ < >
407+ < Icon icon = "media" />
408+ < span > { ` ${ alt } ` } </ span >
409+ </ >
410+ ) : null }
411+ < img className = "stepper-opaque-thumbnail-large" src = { src } alt = { alt ?? "" } />
412+ </ div >
413+ </ div >
414+ ) ;
415+ }
416+
400417/**
401418 * renderNode renders a serialized Stepper AST node to a React ReactNode.
402419 */
@@ -860,14 +877,23 @@ function renderNode(
860877 const src = readNodeProp ( node , part . image ) ;
861878 if ( typeof src !== "string" || ! src . startsWith ( "data:" ) ) return null ;
862879 const alt = part . altProp === undefined ? undefined : readNodeProp ( node , part . altProp ) ;
880+ const altText = alt == null ? "" : String ( alt ) ;
863881 return (
864- < img
882+ < Popover
865883 key = { key }
866- className = { classNames ( "stepper-opaque-thumbnail" , cls ( part . cls ) ) }
867- src = { src }
868- alt = { alt == null ? "" : String ( alt ) }
869- title = { alt == null ? undefined : String ( alt ) }
870- />
884+ interactionKind = "hover"
885+ placement = "bottom"
886+ usePortal = { popoverDepth === 0 }
887+ lazy
888+ popoverClassName = "stepper-popover"
889+ content = { < EnlargedThumbnailPopover src = { src } alt = { altText } /> }
890+ >
891+ < img
892+ className = { classNames ( "stepper-opaque-thumbnail" , cls ( part . cls ) ) }
893+ src = { src }
894+ alt = { altText }
895+ />
896+ </ Popover >
871897 ) ;
872898 }
873899 return null ;
0 commit comments