0.1.3 • Published 4 years ago

react-responsive-bricks v0.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

React Responsive Bricks

A responsive masonry layout for React

Live Demo

Installation

#NPM
npm i --save react-responsive-bricks

#Yarn
yarn add react-responsive-bricks

Usage

import React from "react";
import { Bricks } from "react-responsive-bricks";

//...

let data = [
  {
    imSrc: "link to image"
  },
  {
    imSrc: "link to image"
  },
  {
    imSrc: "link to image"
  },
]

//...

<Bricks data={data} />

Props

PropTypeDefaultDescription
dataArrayArray of objects in the form {imgSrc: "link to img"}. Required
columnsNumber4How many columns to show. Minimum of 1. Has built in logic for responsiveness.
gapNumber0Gap (in pixels) between elements. Minimum of 0
minWidthNumber200Minimum width (in pixels) of each element. Determines wrapping of elements based on width of the browser.
backgroundColorStringwhiteBackground color of the grid. Only seen if gap is more than 0. Supports named colors (e.g. white, red, black, etc) or hex values (e.g. #ffffff)

Todo

This is my list of features I plan to implement in the near future. If you have any ideas reach out!

  • onClick for each element
  • Support for cards as well as images
  • Add more mouseover features