image-gallery-1
freddy/image-gallery-1FreeBlock
Masonry-style responsive gallery using random images with dynamic aspect ratios.
Install it
npx shadcn@latest add https://ui.arkcabin.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 // biome-ignore lint/suspicious/noArrayIndexKey: fixed gallery layout9 <div className="grid gap-4" key={`col-${col}`}>10 {/* biome-ignore lint/nursery/noShadow: false positive */}11 {Array.from({ length: 8 }).map((_, index) => {12 const isPortrait = Math.random() > 0.5;13 const width = isPortrait ? 1080 : 1920;14 const height = isPortrait ? 1920 : 1080;15 const ratio = isPortrait ? 9 / 16 : 16 / 9;1617 return (18 <LazyImage19 alt={`Image ${col}-${index}`}20 fallback={`https://placehold.co/${width}x${height}/`}21 inView={true}22 // biome-ignore lint/suspicious/noArrayIndexKey: fixed gallery image seed23 key={`img-${col}-${index}`}24 ratio={ratio}25 src={`https://picsum.photos/seed/${col}-${index}/${width}/${height}`}26 />27 );28 })}29 </div>30 ))}31 </div>32 </div>33 );34}
What it pulls in
npm packages
Other registry items
Files it writes
More from freddy
All 60 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| announcement-1announcement-1 | freddy | Blocks | Free | 1 dep | |
| announcement-2announcement-2 | freddy | Blocks | Free | 1 dep | |
| announcement-3announcement-3 | freddy | Blocks | Free | 1 dep | |
| auth-1auth-1 | freddy | Blocks | Free | no deps · 2 files | |
| auth-10auth-10 | freddy | Blocks | Free | no deps | |
| auth-11auth-11 | freddy | Blocks | Free | no deps | |
| auth-12auth-12 | freddy | Blocks | Free | no deps | |
| auth-2auth-2 | freddy | Blocks | Free | 1 dep · 3 files |
