image-gallery-1
efferd/image-gallery-1FreeBlock
Masonry-style responsive gallery using random images with dynamic aspect ratios.
Install it
npx shadcn@latest add http://efferd.com/r/image-gallery-1.jsonSource
1import { LazyImage } from "./lazy-image";23export function ImageGallery() {4 return (5 <div className="relative flex min-h-screen w-full flex-col items-center justify-center px-4 py-10">6 <div className="mx-auto grid w-full max-w-5xl grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-4 md:gap-6">7 {Array.from({ length: 4 }).map((_, col) => (8 <div className="grid gap-4" key={col}>9 {/* biome-ignore lint/nursery/noShadow: false positive */}10 {Array.from({ length: 8 }).map((_, index) => {11 const isPortrait = Math.random() > 0.5;12 const width = isPortrait ? 1080 : 1920;13 const height = isPortrait ? 1920 : 1080;14 const ratio = isPortrait ? 9 / 16 : 16 / 9;1516 return (17 <LazyImage18 alt={`Image ${col}-${index}`}19 fallback={`https://placehold.co/${width}x${height}/`}20 inView={true}21 key={`${col}-${index}`}22 ratio={ratio}23 src={`https://picsum.photos/seed/${col}-${index}/${width}/${height}`}24 />25 );26 })}27 </div>28 ))}29 </div>30 </div>31 );32}
What it pulls in
npm packages
Other registry items
Files it writes
More from efferd
All 201 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| app-shell-1app-shell-1 | efferd | Blocks | Paid | no deps · 7 files | |
| app-shell-10app-shell-10 | efferd | Blocks | Paid | 1 dep · 13 files | |
| app-shell-2app-shell-2 | efferd | Blocks | Paid | no deps · 9 files | |
| app-shell-3app-shell-3 | efferd | Blocks | Paid | no deps · 9 files | |
| app-shell-4app-shell-4 | efferd | Blocks | Paid | no deps · 9 files | |
| app-shell-5app-shell-5 | efferd | Blocks | Free | 1 dep · 9 files | |
| app-shell-6app-shell-6 | efferd | Blocks | Paid | no deps · 11 files | |
| app-shell-7app-shell-7 | efferd | Blocks | Paid | no deps · 12 files |
