All Projects → patrickgalbraith → React Equalizer

patrickgalbraith / React Equalizer

Licence: mit
Pure React Match Height Component

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Equalizer

Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+58421.88%)
Mutual labels:  babel, jest
Express React Boilerplate
🚀🚀🚀 This is a tool that helps programmers create Express & React projects easily base on react-cool-starter.
Stars: ✭ 32 (+0%)
Mutual labels:  babel, jest
Pwa
An opinionated progressive web app boilerplate
Stars: ✭ 353 (+1003.13%)
Mutual labels:  babel, jest
medly-components
🧩 Medly components provides numerous themable react components, each with multiple varitaions of sizes, colors, position etc.
Stars: ✭ 66 (+106.25%)
Mutual labels:  babel, jest
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (+1334.38%)
Mutual labels:  babel, jest
React Native Navigation Redux Starter Kit
React Native Navigation(v2) Starter Kit with Redux, Saga, ESLint, Babel, Jest and Facebook SDK 😎
Stars: ✭ 271 (+746.88%)
Mutual labels:  babel, jest
Webpack React Boilerplate
Minimal React 16 and Webpack 4 boilerplate with babel 7, using the new webpack-dev-server, react-hot-loader, CSS-Modules
Stars: ✭ 358 (+1018.75%)
Mutual labels:  babel, jest
Front End Guide
📚 Study guide and introduction to the modern front end stack.
Stars: ✭ 14,073 (+43878.13%)
Mutual labels:  babel, jest
Opensource
Delivering delightful digital solutions. Open Source packages with combined ~85M/month downloads, semantically versioned following @conventional-commits. Fully powered by Jest, @Babel TypeScript, @Airbnb @ESLint + @Prettier, @YarnPKG + @Lerna independent versioning, GH @Actions & automated dep updates with @RenovateBot.
Stars: ✭ 459 (+1334.38%)
Mutual labels:  babel, jest
Entria Fullstack
Monorepo Playground with GraphQL, React, React Native, Relay Modern, TypeScript and Jest
Stars: ✭ 434 (+1256.25%)
Mutual labels:  babel, jest
react-multi-context
Manage multiple React 16 contexts with a single component.
Stars: ✭ 19 (-40.62%)
Mutual labels:  babel, jest
Serverless Typescript Starter
🗄🙅‍♀️ Deploy your next serverless JavaScript function in seconds
Stars: ✭ 653 (+1940.63%)
Mutual labels:  babel, jest
React
Extremely simple boilerplate, easiest you can find, for React application including all the necessary tools: Flow | React 16 | redux | babel 6 | webpack 3 | css-modules | jest | enzyme | express + optional: sass/scss
Stars: ✭ 244 (+662.5%)
Mutual labels:  babel, jest
React Bolt
⚡ The most simple & robust boilerplate for your React projects.
Stars: ✭ 298 (+831.25%)
Mutual labels:  babel, jest
Babel Plugin Tester
Utilities for testing babel plugins
Stars: ✭ 228 (+612.5%)
Mutual labels:  babel, jest
Js Library Boilerplate Basic
Javascript Minimal Starter Boilerplate - Webpack 5 🚀, Babel 7, UMD, Unit Testing
Stars: ✭ 354 (+1006.25%)
Mutual labels:  babel, javascript-library
Lerna Yarn Workspaces Monorepo
🐉 A Monorepo with multiple packages and a shared build, test, and release process.
Stars: ✭ 201 (+528.13%)
Mutual labels:  babel, jest
Js Library Boilerplate
Javascript Starter Boilerplate - Webpack 4, Babel 7, UMD, Hot Reloading, and more
Stars: ✭ 202 (+531.25%)
Mutual labels:  babel, javascript-library
Nod
Node.js module generator/boilerplate with Babel, Jest, Flow, Documentation and more
Stars: ✭ 355 (+1009.38%)
Mutual labels:  babel, jest
Express Babel
Express starter kit with ES2017+ support, testing, linting, and code coverage
Stars: ✭ 621 (+1840.63%)
Mutual labels:  babel, jest

Build Status

React Equalizer

Pure React component which equalizes heights of components.

Installation

npm install --save react-equalizer

Usage

This is a basic example which equalizes height of child components.

<Equalizer>
  <div>Child 1</div>
  <div>Child 2</div>
  <div>Child 3</div>
</Equalizer>

Options

Prop Default Description
property height The style property used when setting height. Usually height, maxHeight or minHeight.
byRow true By default Equalizer will attempt to take into account stacking by matching rows by their window offset.
enabled (component, node) => true Takes a function that returns true or false and can be used to disable Equalizer. Useful if you want to disable Equalizer when something changes such as window width or height based on a media query..
nodes
(component, node) =>
  node.children
Function which returns nodes to equalize. By default Equalizer only measures the heights of its direct descendants.

Simple example with options

<Equalizer
  byRow={false}
  property="maxHeight"
  enabled={() => window.matchMedia("(min-width: 400px)").matches}>
  <div>Child 1</div>
  <div>Child 2</div>
  <div>Child 3</div>
</Equalizer>

Specifying nodes example

This can be useful if you want to equalize components other than direct descendants.

class MyComponent extends Component {
  getNodes(equalizerComponent, equalizerElement) {
    return [
      this.refs.node1,
      this.refs.node2,
      this.refs.node3
    ]
  }

  render() {
    return(
      <Equalizer nodes={() => this.getNodes()}>
        <div ref={n => this.node1 = n}></div>
        <div>
          <div ref={n => this.node2 = n}></div>
        </div>
        <div ref={n => this.node3 = n}></div>
      </Equalizer>
    )
  }
}

Demo

http://jsbin.com/ceyumumuye/edit?js,output

Running Tests

Grab the latest source and in the project directory run:

npm install
npm test

Roadmap

  • Add support for setting height of Equalizer component based on total height of children. This will be useful if children are positioned absolutely and the container needs to have a fixed height.

References

  • Zurb Foundation Equalizer
  • jQuery Match Height
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].