Loupe Surface Studies
Square studies of material and surface texture. Opening a study hands you a loupe: a round, bounded window that magnifies whatever sits under it as you move the pointer across the image, tracked live with onPointerMove and clamped coordinates so the lens never runs off the edge of the photo.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button, media-slot dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/loupe-surface-studies.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/gallery/gallery4.tsx instead.
Usage
The file also exports gallery4Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Gallery4, gallery4Demo } from "@/components/blocks/gallery/gallery4"; export default function Page() { return <Gallery4 {...gallery4Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Surface Studies" | Section heading above the grid. |
| description | string | "Close studies of material and texture. Move the loupe across the image to magnify it." | Short supporting copy under the heading. |
| studies | SurfaceStudy[] | none | The surface studies, rendered as a grid in the order passed in. |
| className | string | none | Extra classes for the outer section element. |
Types
type SurfaceStudy = { title: string; material: string; image: { src: string; alt: string }; };
Behavior notes
- The loupe is real pointer-tracked state, not a hover-only CSS effect: onPointerMove reads the bounded container's getBoundingClientRect() on every move, clamps the local x/y to the container's bounds, and stores it in useState.
- The lens itself is an absolutely-positioned circular div whose left/top are clamped a second time so the ~150px window always stays fully inside the container, even when the pointer sits at the very edge.
- Magnification is a plain, oversized duplicate <img> inside the lens, offset by a negative left/top computed from the clamped pointer position times a fixed 2.5x zoom scale, no canvas or WebGL involved.
- The lens hides on pointer leave and resets whenever you move to a different study via the prev/next controls or arrow keys.
More Gallery Blocks
View all →Plan Chest Sheet Stack
Ruled plan-chest drawer index that opens into a real stack viewer with a lift-and-rotate top sheet.
Wall Scale Viewer
Print grid with a wall-mockup viewer that scales the piece as you switch between size options.
Archive Record Cards
Text-first archive index that opens into a real 3D flip card of front image and back registrar notes.
Paired Hang Compare
Two-to-a-bay staggered hang whose viewer can split into two real panes to compare a second work.
Dark Room Fade Viewer
Inverted low-light hang that opens into a chromeless viewer, the work fading up like a dimmer lamp.
Counter Scrolling Image Bands
Two full-bleed image tracks scrolling in opposite directions, opening a framed lightbox on click.