JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q44926F
  • License MIT

Simple for use and beutiful layout for photo

Package Exports

  • photo-flex-layout
  • photo-flex-layout/dist/index.cjs
  • photo-flex-layout/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (photo-flex-layout) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.