A lightweight design agent built with libfx. Describe a page and an agent writes it as one HTML file.
TypeScript
Open attached images at twice their size
Esteban Suarez846eab02d91e
diff --git a/components/image-preview.tsx b/components/image-preview.tsxindex 3f4b6f2..64ecea3 100644--- a/components/image-preview.tsx+++ b/components/image-preview.tsx@@ -3,10 +3,11 @@import { useState } from 'react'import { Dialog, DialogContent, DialogTitle } from './ui/dialog'-// An attached image's thumbnail that opens the image full size. History keeps a-// small JPEG of each image, so there it opens at that size rather than scaling up.+// An attached image's thumbnail that opens the image enlarged. History keeps only a+// small JPEG of each image, so it opens at twice its size, within the window.export default function ImagePreview({ src, alt, className }: { src: string; alt: string; className: string }) {const [open, setOpen] = useState(false)+ const [width, setWidth] = useState<number>()return (<><button@@ -26,7 +27,13 @@ export default function ImagePreview({ src, alt, className }: { src: string; alt><DialogTitle className="sr-only">{alt}</DialogTitle>{/* eslint-disable-next-line @next/next/no-img-element */}- <img src={src} alt={alt} className="max-h-[calc(100dvh-4rem)] max-w-full object-contain" />+ <img+ src={src}+ alt={alt}+ onLoad={(event) => setWidth(event.currentTarget.naturalWidth * 2)}+ style={width ? { width } : undefined}+ className="h-auto max-h-[calc(100dvh-4rem)] max-w-full object-contain"+ /></DialogContent></Dialog></>