0.1.0 • Published 8 months ago

@tx666/masonry v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Masonry layout 📌

Pinterest like Masonry Layout built with React, TypeScript, and CSS

Masonry Component

The Masonry Component takes in 2 params data, column

  • Data is required and should be an array of object with src inside
  • column sets the number of columns you want, you can provide an object with the xs, sm, md, lg, xl, xxl and define the number of columns you want in each breakpoint.

Breakpoints & Width

PS: if the innerWidth of the window is less than 640px it is xs, same for the rest of the values and if the width is great than 1536px, it is xxl.

breakpointsvaluewidth
less than 640xs50%
< 768sm50%
< 1024md40%
< 1280lg30%
< 1536xl25%
greater than 1536xxl25%

Width

How to use

Provide an object with the number of columns you want to display in each breakpoint.

import { Masonry } from '@tx666/masonry';

const Gallery = () => {
  const columns = {
    xs: 2,
    sm: 2,
    md: 3,
    lg: 3,
    xl: 4,
    xxl: 5,
  };

  const data = [{ src: 'link to your image' }, { src: 'link to your image' }];
  return <Masonry data={data} column={columns} />;
};

TODOs

  • find a better way to equally distribute the items in each array

Issue

If you find any issues or bugs, please report them here.

0.1.0

8 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago