Plock is a responsive masonry layout implementation for React. Very simple to use and easy to understand.

Overview


Build Status Release Stars License


About Plock 🌈

Plock is a responsive masonry layout implementation for React. Very simple to use and easy to understand.

Can I see a demo? 👀

The demo is available for you here!

Getting Started 🤩

Install the package with yarn or npm:

$ yarn add react-plock
$ npm install react-plock

The most simple way to use Plock is to import it in your React app:

import { Plock } from 'react-plock';

<Plock>
  <SuperComponent>I'm a super component! 😎</SuperComponent>
  <SuperComponent>I'm a super component too! 🤓</SuperComponent>
  <SuperComponent>Don't forget me! 😏</SuperComponent>
</Plock>

And that's it! 🎉 🎉 🎉 By default, Plock will use the grid layout with three columns. You can also override this prop by setting the nColumns prop:

<Plock nColumns={2}>
  <div style={{ height: 100, width: "100%", background: "yellow" }}>1</div>
  <div style={{ height: 200, width: "100%", background: "blue" }}>2</div>
  <div style={{ height: 150, width: "100%", background: "red" }}>3</div>
  <div style={{ height: 500, width: "100%", background: "orange" }}>4</div>
</Plock>

Also the gap between columns can be set by setting the gap prop:

<Plock nColumns={3} gap={10}>
  <div style={{ height: 100, width: "100%", background: "yellow" }}>1</div>
  <div style={{ height: 200, width: "100%", background: "blue" }}>2</div>
  <div style={{ height: 150, width: "100%", background: "red" }}>3</div>
  <div style={{ height: 500, width: "100%", background: "orange" }}>4</div>
</Plock>

Needs also some extra styling? No problem, you can extend the default styles by setting the style or the className prop:

<Plock style={{ background: "red" }} className="an-happy-class">
  <div style={{ height: 100, width: "100%", background: "yellow" }}>1</div>
  <div style={{ height: 200, width: "100%", background: "blue" }}>2</div>
  <div style={{ height: 150, width: "100%", background: "red" }}>3</div>
  <div style={{ height: 500, width: "100%", background: "orange" }}>4</div>
</Plock>

Built With 🏗️

Versioning 🚦

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors 🙋

Stargazers 🌟

Stargazers repo roster for @itsrennyman/react-plock

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Comments
  • Build fails on Gatsby project - WebpackError: ReferenceError: window is not defined

    Build fails on Gatsby project - WebpackError: ReferenceError: window is not defined

    Hello, I am using react-plock for a Gatsby project and it's causing the build to fail.

    Definition in package.json, "react-plock": "^1.1.0",

    Error message, WebpackError: ReferenceError: window is not defined

    • index.js:1 [ramitmitra.com]/[react-plock]/dist/index.js:1:409

    • index.js:1 [ramitmitra.com]/[react-plock]/dist/index.js:1:789

    • react.js:35 [ramitmitra.com]/[fast-deep-equal]/react.js:35:32

    • useCallbackRef.js:28 [ramitmitra.com]/[@restart]/hooks/esm/useCallbackRef.js:28:18

    • useEventCallback.js:6 [ramitmitra.com]/[@restart]/hooks/esm/useEventCallback.js:6:1

    • static-entry.js:295 webpack:/ramitmitra.com/.cache/static-entry.js:295:22

    • useMounted.js:2 [ramitmitra.com]/[@restart]/hooks/esm/useMounted.js:2:1

    Please look into the issue and release a fix. Thank you for the great package and all the hard work.

    opened by ramit-mitra 3
  • UseLayoutEffect warning in NextJs

    UseLayoutEffect warning in NextJs

    When using this package in NextJs, I get the following warning:

    Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.

    Any chance for SSR support?

    opened by bosbode 2
  • The automated release is failing 🚨

    The automated release is failing 🚨

    :rotating_light: The automated release from the next branch failed. :rotating_light:

    I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

    You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

    Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

    Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the next branch. You can also manually restart the failed CI job that runs semantic-release.

    If you are not sure how to resolve this, here are some links that can help you:

    If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


    Invalid npm token.

    The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

    If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default " Authorization and writes" level.

    Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


    Good luck with your project ✨

    Your semantic-release bot :package::rocket:

    semantic-release 
    opened by itsrennyman 1
  • Error when doing `npm install` for most recent React version

    Error when doing `npm install` for most recent React version

    Description

    When running npm install react-plock I get the following error:

    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! While resolving: [email protected]
    npm ERR! Found: [email protected]
    npm ERR! node_modules/react
    npm ERR!   react@"^18.2.0" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer react@"18.1.0" from [email protected]
    npm ERR! node_modules/react-plock
    npm ERR!   react-plock@"*" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    

    I'm currently on version 18.2.0 of React which is why this is erroring. I believe to fix this, the related dependencies just need to be updated.

    Thanks!

    opened by GV79 0
  • Error importing jsx-runtime

    Error importing jsx-runtime

    I get this error using nextJs:

    Error [ERR_MODULE_NOT_FOUND]: Cannot find module '~/node_modules/react/jsx-runtime' imported from ~/node_modules/react-plock/index.js
    Did you mean to import react/jsx-runtime.js?
    
    opened by philohelp 4
  • Plock grid re-hydration on URL search query change in Next.js, which might cause a delay in onClick events of grid items.

    Plock grid re-hydration on URL search query change in Next.js, which might cause a delay in onClick events of grid items.

    Possible steps to reproduce,

    1. Add an onClick event on the items to update URL search params.
    2. The click event is not working sometimes, It's not consistent though.
    3. Try making the cursor out of focus in the inspector and click directly on the item.
    4. It is recreating the grid on every item click.

    Also, there is a delay in Masonry formation, after the DOM hydrates it takes a second to form masonry grid. Is there a config or possible fix?

    opened by rahulcn 1
Releases(v2.0.0)
Owner
Renato Pozzi
Coding. Reading. Chilling.
Renato Pozzi
A draggable and resizable grid layout with responsive breakpoints, for React.

React-Grid-Layout React-Grid-Layout is a grid layout system much like Packery or Gridster, for React. Unlike those systems, it is responsive and suppo

RGL 16.9k Jan 4, 2023
here in this git repo you will get react js basic layout, having in responsive mode.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 3 Feb 23, 2022
This is a simpler project than the full webpack source code, and you can understand the design ideas in webpack through it

my-webpack 这是一个简化版的webpack,旨在于理解webpack的设计原理以及webpack当中 loader和plugin的区别,运行方式。 运行步骤如下(方案一): 切换到my-webpack目录,运行npm install 切换到test目录,运行npm install 在tes

null 14 Sep 30, 2022
Visual layout editor for matplotlib and any plotting library built upon matplotlib like seaborn.

Matplotlib Layout Generator Before you start: You must have experience with using matplotlib. It needs to be use on desktop. Not designed for mobile.

null 4 Dec 1, 2022
MSN Redesign made with Next - Inspired by Igor Monteiro's Layout

MSN Redesign ?? Made with Next - Inspired by Igor Monteiro's Layout | Behance ??️ Stack Next React Yarn (v1.22.17) CSS in JS CSS - Gradient Responsive

Lais Frigério 6 Feb 16, 2022
Easy and simple to use Radio Buttons for your React Native Application.

React Native Simple Radio Buttons Easy and simple to use Radio Buttons for your React Native Application. Installation npm i react-native-custom-radio

Neelesh Ranjan Jha 2 Feb 8, 2022
Very simple app to decode your Vaccination Proof QR Code (such as the one provided by government of Quebec) - Compatible with SHC (Smart Health Card standard)

shc-covid19-decoder Visit simple hosted version on your phone (does NOT transmit any data, all remains in your browser) https://fproulx.github.io/shc-

François Proulx 148 Sep 23, 2022
🐥 A very simple way to transform antd table to xlsx

antd-table-2-xlsx antd-table-2-xlsx A very simple way to transform antd table to xlsx . Get Start! Install pnpm add @sudongyuer/antd-table-2-xlsx Usa

Frozen FIsh 18 Aug 15, 2022
An easy-to-use super customisable form validation library for React.

An easy-to-use super customisable form validation library for React. This library handles all of your form states using built in useReducer hook of react.

Himanshu Bhardwaz 2 Jun 30, 2022
TryShape is an open-source platform to create shapes of your choice using a simple, easy-to-use interface. You can create banners, circles, polygonal shapes, export them as SVG, PNG, and even as CSS.

Create, Export, Share, and Use any Shapes of your choice. View Demo · Report Bug · Request Feature ?? Introducing TryShape TryShape is an opensource p

TryShape 148 Dec 26, 2022
React.js Responsive Minimal Carousel

React Carousel Minimal Easy to use, responsive and customizable carousel component for React Projects. Installation npm i react-carousel-minimal Demo

Sahil Saha 82 Dec 23, 2022
A very lightweight and flexible accessible modal dialog script.

A11y Dialog This is a lightweight (1.3Kb) yet flexible script to create accessible dialog windows. Documentation ↗ Demo on CodeSandbox ↗ Features: Clo

Kitty Giraudel 2.1k Jan 2, 2023
A simple and responsive quizlet-like flashcard component with a few additional options

Welcome to react-quizlet-flashcard ?? A simple and responsive quizlet-like flashcard component with a few additional options. Front and back card acce

A.B.Santhosh 14 Dec 17, 2022
This command line helps you create components, pages and even redux implementation for your react project

react-help-create This command line helps you create components, pages and even redux implementation for your react project. How to install it? To ins

Omar 27 Dec 10, 2022
react-dialog is a custom react hook to use a dialog easily

react-dialog react-dialog is a custom react hook to use a dialog easily. Documentation To use react-dialog follow the documentation. useDialog Returns

Levy Mateus Macedo 2 Mar 29, 2022
KochSnowFlake - implementation of Koch Snowflake with React+ TS

Koch Snowflake if you just want to play with it, follow, FOLLOW THIS LINK if you are curios about math of this project, FOLLOW THIS LINK installation

Mahyar 1 Mar 13, 2022
An implementation of React v15.x that optimizes for small script size

react-lite Introduction react-lite is an implementation of React that optimizes for small script size. Note: react-lite dose not support React v16.x n

工业聚 1.7k Dec 10, 2022
An implementation of GitHub's Primer Design System using React

Primer React A React implementation of GitHub's Primer Design System Documentation Our documentation site lives at primer.style/react. You'll be able

Primer 2.2k Dec 26, 2022
This is a Javascript / React implementation of Discord's OverlappingPanels

Overlapping Panels Gestures-driven navigation UI for React.js This is a Javascript / React implementation of Discord's OverlappingPanels. Gesture-base

Paul Makles 5 Feb 18, 2022