How to use the gestalt.Masonry.createMeasurementStore function in gestalt

To help you get started, we’ve selected a few gestalt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pinterest / gestalt / test / containers / MasonryExample.js View on Github external
import React from 'react';
import { Masonry } from 'gestalt';
import PropTypes from 'prop-types';
import Item from './ExampleGridItem.js';

const store = Masonry.createMeasurementStore();

const getRandomColor = () => {
  const letters = '0123456789ABCDEF';
  let color = '#';
  for (let i = 0; i < 6; i += 1) {
    color += letters[Math.floor(Math.random() * 16)];
  }
  return color;
};

const getRandomNumberGenerator = seed => {
  let localSeed = seed;
  return () => {
    localSeed += 1;
    const rnd = Math.sin(localSeed);
    return rnd - Math.floor(rnd);

gestalt

A set of React UI components which enforce Pinterest’s design language

Apache-2.0
Latest version published 1 day ago

Package Health Score

90 / 100
Full package analysis