1.0.0 • Published 2 years ago

photo-flex-layout v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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.

1.0.0

2 years ago

1.0.0-beta.0

2 years ago

1.0.0-beta.1

2 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago