Responsive masonry layout with React & flexbox 😎

  • columns : p % columns – orderString += ` – :nth-child(${p}) { – order: ${order}; – } – ` – } – return orderString – } – – /** – * Generate media queries for configuration breakpoints – * This entails setting the width of Panels at different viewport width…
  • masonry-panel { – width: ${100 / columns}%; – ${css` – columns)}; – `} – } – } – ` – } – return mediaString – } – – /** – * The container for our Masonry layout – * If there is configuration and we have children, then generate media…
  • : ‘animation: fadeOut 1s’} – transition: visibility 1s linear; – } – ` – – /** – * Simple panel elements – * Don’t have anything special happening – * The masonry-panel class is exposed so can be styled with CSS – */ – const MasonryPanel = styled.div` – overflow:…
  • debounce(this.layout, 0)) – } – /** – * Wipe the component state and reset it default, Don’t think this is necessary as setState overrides anyway – */ – // reset = () = { – // // this.setState({ – // // heights: [], – // // loading: false, – //…
  • heights[order – 1]) heights[order – 1] = 0 – heights[order – 1] = heights[order – 1] + parseInt(height, 10) – } – this.setState({ heights }) – } – /** – * Set the layout height based on referencing the content cumulative height – * This probably doesn’t need its own…

I put together a “true” masonry layout [pen](https://codepen.io/jh3y/pen/vgZWZL) a while back. I’ve been asked a couple of times how I’d go about port…
Continue reading “Responsive masonry layout with React & flexbox 😎”

Optional Chaining Operator in JavaScript – Bene Studio

  • var user = { name: ‘Joe’ } – var zip = user.address.zip // ⚡⚡⚡Uncaught TypeError: Cannot read property ‘zip’ of undefinedIn this example we expect user.address.zip to exist but for some reason the address is missing from the user object.
  • Workaround #1: Logic Expressionsvar user = { name: ‘Joe’ } – var zip = user – user.address – user.address.zipNoisy and verbose.
  • Workaround #2: Ternary Operatorsvar user = { name: ‘Joe’ } – var zip = – user === undefined – ?
  • Workaround #3: Try-Catchvar user = { name: ‘Joe’ } – var ziptry { – zip = user.address.zip – } catch (error) { – zip = null – }Breaks control and has own scopes.
  • bin/babel index.jsThe Transpiled CodeTranspiled version of the index.js above: – var _user$address;var user = { – name: ‘Joe’ – };var zip = – user == null – ?

All of us usually confronts the situation where an expected member of a property chain is undefined or null. In this example we expect user.address.zip to exist but for some reason the address is…
Continue reading “Optional Chaining Operator in JavaScript – Bene Studio”

#ReactJS State Management Practice

#ReactJS State Management Practice

  • You can apply CSS to your Pen from any stylesheet on the web.
  • Just put a URL to it here and we’ll apply it, in the order you have them, before the CSS in the Pen itself.
  • If the stylesheet you link to has the file extension of a preprocessor, we’ll attempt to process it before applying.
  • You can also link to another Pen here, and we’ll pull the CSS from that Pen and include it.
  • If it’s using a matching preprocessor, we’ll combine the code before preprocessing, so you can use the linked Pen as a true dependency.


Continue reading “#ReactJS State Management Practice”

Clean React Toggle @CodePen @greensock @reactjs #svg #animation #ui #minimal

Clean React Toggle @CodePen  @greensock @reactjs #svg #animation #ui #minimal

  • You can apply CSS to your Pen from any stylesheet on the web.
  • Just put a URL to it here and we’ll apply it, in the order you have them, before the CSS in the Pen itself.
  • If the stylesheet you link to has the file extension of a preprocessor, we’ll attempt to process it before applying.
  • You can also link to another Pen here, and we’ll pull the CSS from that Pen and include it.
  • If it’s using a matching preprocessor, we’ll combine the code before preprocessing, so you can use the linked Pen as a true dependency.

Working on some tight, clean, minimal interaction….
Continue reading “Clean React Toggle @CodePen @greensock @reactjs #svg #animation #ui #minimal”

Simple SVG Dial in #react @CodePen @greensock @reactjs #svg #ui (might be useful!)

Simple SVG Dial in #react @CodePen  @greensock @reactjs #svg #ui (might be useful!)

  • You can apply CSS to your Pen from any stylesheet on the web.
  • Just put a URL to it here and we’ll apply it, in the order you have them, before the CSS in the Pen itself.
  • If the stylesheet you link to has the file extension of a preprocessor, we’ll attempt to process it before applying.
  • You can also link to another Pen here, and we’ll pull the CSS from that Pen and include it.
  • If it’s using a matching preprocessor, we’ll combine the code before preprocessing, so you can use the linked Pen as a true dependency.


Continue reading “Simple SVG Dial in #react @CodePen @greensock @reactjs #svg #ui (might be useful!)”

“ReactJS Transitions” byKelly Harrop

  • You can apply CSS to your Pen from any stylesheet on the web.
  • Just put a URL to it here and we’ll apply it, in the order you have them, before the CSS in the Pen itself.
  • If the stylesheet you link to has the file extension of a preprocessor, we’ll attempt to process it before applying.
  • You can also link to another Pen here, and we’ll pull the CSS from that Pen and include it.
  • If it’s using a matching preprocessor, we’ll combine the code before preprocessing, so you can use the linked Pen as a true dependency.

Create fluid transitions using ReactJS….
Continue reading ““ReactJS Transitions” byKelly Harrop”

Testing responsive grid design using CSS flex in @preactjs (@reactjs). Link:

Testing responsive grid design using CSS flex in @preactjs (@reactjs). Link:

  • You can apply CSS to your Pen from any stylesheet on the web.
  • Just put a URL to it here and we’ll apply it, in the order you have them, before the CSS in the Pen itself.
  • If the stylesheet you link to has the file extension of a preprocessor, we’ll attempt to process it before applying.
  • You can also link to another Pen here, and we’ll pull the CSS from that Pen and include it.
  • If it’s using a matching preprocessor, we’ll combine the code before preprocessing, so you can use the linked Pen as a true dependency.

Built in Preact.js….
Continue reading “Testing responsive grid design using CSS flex in @preactjs (@reactjs). Link:”