summaryrefslogtreecommitdiffstats
path: root/web/react/components/error_bar.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-10-07 09:13:42 -0700
committer=Corey Hulen <corey@hulen.com>2015-10-07 09:13:42 -0700
commit8a65601db424d5969448b06ae4e3048a7f34bd94 (patch)
treef7d6bf98206939f4536e7e041532661b8f5630ed /web/react/components/error_bar.jsx
parente83dd553611abddd142a73805392b069a65caf67 (diff)
downloadchat-8a65601db424d5969448b06ae4e3048a7f34bd94.tar.gz
chat-8a65601db424d5969448b06ae4e3048a7f34bd94.tar.bz2
chat-8a65601db424d5969448b06ae4e3048a7f34bd94.zip
Fixing resize
Diffstat (limited to 'web/react/components/error_bar.jsx')
-rw-r--r--web/react/components/error_bar.jsx31
1 files changed, 16 insertions, 15 deletions
diff --git a/web/react/components/error_bar.jsx b/web/react/components/error_bar.jsx
index 787b716be..5aa55be93 100644
--- a/web/react/components/error_bar.jsx
+++ b/web/react/components/error_bar.jsx
@@ -9,6 +9,7 @@ export default class ErrorBar extends React.Component {
this.onErrorChange = this.onErrorChange.bind(this);
this.handleClose = this.handleClose.bind(this);
+ this.resize = this.resize.bind(this);
this.prevTimer = null;
this.state = ErrorStore.getLastError();
@@ -45,32 +46,32 @@ export default class ErrorBar extends React.Component {
return false;
}
+ resize() {
+ if (this.isValidError(this.state)) {
+ var height = $(React.findDOMNode(this)).outerHeight();
+ height = height < 30 ? 30 : height;
+ $('body').css('padding-top', height + 'px');
+ } else {
+ $('body').css('padding-top', '0');
+ }
+ }
+
componentDidMount() {
ErrorStore.addChangeListener(this.onErrorChange);
$(window).resize(() => {
- if (this.isValidError(this.state)) {
- var height = $(React.findDOMNode(this)).outerHeight();
- height = height < 30 ? 30 : height;
- $('body').css('padding-top', height + 'px');
- } else {
- $('body').css('padding-top', '0');
- }
+ this.resize();
});
+
+ this.resize();
}
componentWillUnmount() {
ErrorStore.removeChangeListener(this.onErrorChange);
}
- componentDidUpdate(nextProps, nextState) {
- if (this.isValidError(nextState)) {
- var height = $(React.findDOMNode(this)).outerHeight();
- height = height < 30 ? 30 : height;
- $('body').css('padding-top', height + 'px');
- } else {
- $('body').css('padding-top', '0');
- }
+ componentDidUpdate() {
+ this.resize();
}
onErrorChange() {