photo-flex-layout
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Photo Flex Layout

Github license Npm version Npm types Bundlephobia size

Simple for use and beutiful layout for photo.

  • Small 2 kbytes (minified and gzipped). Size Limit controls the size.
  • Beutiful This is implementation Google Photo Flex Layout
  • Framework agnostic
  • It has good TypeScript support.

Install

npm add photo-flex-layout

Usage

import { photoFlexLayout } from 'photo-flex-layout';

const { containerHeight, boxes } = photoFlexLayout({
  targetRowHeight: 200,
  containerWidth: 500,
  boxSpacing: 0,
  items: [
    { width: 100, height: 200 },
    { width: 150, height: 100 },
    { width: 100, height: 100 },
    { width: 100, height: 100 },
    { width: 100, height: 100 },
    { width: 100, height: 100 },
  ],
});

containerHeight; //334

boxes; // [{width: 83.5, height: 167, top: 0, left: 0, ...}, {width: 250.5, height: 167, top: 10, left: 83.5, ...}, ...]

Thanks

Inspired by react-photo-gallery by Sandra Gonzales.

Package Sidebar

Install

npm i photo-flex-layout

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

37.9 kB

Total Files

9

Last publish

Collaborators

  • dskrylnikov