Skip to content

Conversation

ranbena
Copy link
Contributor

@ranbena ranbena commented Apr 30, 2019

  • Refactor

Description

Ported the auto height feature

Included:

  • Auto height param taken from widget service info
  • Triggered by change to height of widget header / body / footer
  • Feature available in single column mode
  • Related tests unskipped and passing

Mobile & Desktop Screenshots/Recordings

🔔 Red stripe indicator on top is for local testing purposes only. Not in prod. 🔔

Auto resizes on update

Manual resize revokes auto height


start = () => {
this.stop();
this.interval = setInterval(this.checkHeightChanges, INTERVAL);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kravets-levko Eventually implemented with polling cause ResizeObserver turned out to be not a good fit - complex when observing multiple elements per widget.

margin={[cfg.margins, cfg.margins]}
isDraggable={this.props.isEditing}
isResizable={this.props.isEditing}
onResizeStart={this.autoHeightCtrl.stop}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When widget is manually resized, interval is paused and then resumed to avoid "height fights" and also better perf.

@ranbena ranbena marked this pull request as ready for review April 30, 2019 18:33
@ranbena ranbena requested review from arikfr and kravets-levko April 30, 2019 18:33
return reduce(els, (acc, el) => {
const height = el ? el.getBoundingClientRect().height : 0;
return acc + height;
}, 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS I would like to eventually move away from checking multiple element heights - with the right HTML/CSS changes, the same look and functionality can be implemented with observation of a single element.

@kravets-levko kravets-levko merged commit 6425c56 into 2-single-col May 3, 2019
@kravets-levko kravets-levko deleted the 3-auto-height branch May 3, 2019 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants