-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Dashboard Grid #3 - Auto Height #3749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
start = () => { | ||
this.stop(); | ||
this.interval = setInterval(this.checkHeightChanges, INTERVAL); |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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.
return reduce(els, (acc, el) => { | ||
const height = el ? el.getBoundingClientRect().height : 0; | ||
return acc + height; | ||
}, 0); |
There was a problem hiding this comment.
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.
Description
Ported the auto height feature
Included:
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