Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const bodyStyles: React.CSSProperties = {
overflow: 'auto'
};
if (node) {
// default margin
let headerHeight = 46;
let footerHeight = 46;
let contentHeight = 30;
const headerDOM = node.querySelector(`.${this.addPrefix('header')}`);
const footerDOM = node.querySelector(`.${this.addPrefix('footer')}`);
const contentDOM = node.querySelector(`.${this.addPrefix('content')}`);
headerHeight = headerDOM ? getHeight(headerDOM) + headerHeight : headerHeight;
footerHeight = footerDOM ? getHeight(footerDOM) + headerHeight : headerHeight;
contentHeight = contentDOM ? getHeight(contentDOM) + contentHeight : contentHeight;
if (drawer) {
bodyStyles.height = contentHeight - (headerHeight + footerHeight);
} else {
/**
* Header height + Footer height + Dialog margin
*/
const excludeHeight = headerHeight + footerHeight + 60;
const bodyHeight = getHeight(window) - excludeHeight;
const maxHeight = scrollHeight >= bodyHeight ? bodyHeight : scrollHeight;
bodyStyles.maxHeight = maxHeight;
}
}
overflow: 'auto'
};
if (node) {
// default margin
let headerHeight = 46;
let footerHeight = 46;
let contentHeight = 30;
const headerDOM = node.querySelector(`.${this.addPrefix('header')}`);
const footerDOM = node.querySelector(`.${this.addPrefix('footer')}`);
const contentDOM = node.querySelector(`.${this.addPrefix('content')}`);
headerHeight = headerDOM ? getHeight(headerDOM) + headerHeight : headerHeight;
footerHeight = footerDOM ? getHeight(footerDOM) + headerHeight : headerHeight;
contentHeight = contentDOM ? getHeight(contentDOM) + contentHeight : contentHeight;
if (drawer) {
bodyStyles.height = contentHeight - (headerHeight + footerHeight);
} else {
/**
* Header height + Footer height + Dialog margin
*/
const excludeHeight = headerHeight + footerHeight + 60;
const bodyHeight = getHeight(window) - excludeHeight;
const maxHeight = scrollHeight >= bodyHeight ? bodyHeight : scrollHeight;
bodyStyles.maxHeight = maxHeight;
}
}
styles.bodyStyles = bodyStyles;
const bodyStyles: React.CSSProperties = {
overflow: 'auto'
};
if (node) {
// default margin
let headerHeight = 46;
let footerHeight = 46;
let contentHeight = 30;
const headerDOM = node.querySelector(`.${this.addPrefix('header')}`);
const footerDOM = node.querySelector(`.${this.addPrefix('footer')}`);
const contentDOM = node.querySelector(`.${this.addPrefix('content')}`);
headerHeight = headerDOM ? getHeight(headerDOM) + headerHeight : headerHeight;
footerHeight = footerDOM ? getHeight(footerDOM) + headerHeight : headerHeight;
contentHeight = contentDOM ? getHeight(contentDOM) + contentHeight : contentHeight;
if (drawer) {
bodyStyles.height = contentHeight - (headerHeight + footerHeight);
} else {
/**
* Header height + Footer height + Dialog margin
*/
const excludeHeight = headerHeight + footerHeight + 60;
const bodyHeight = getHeight(window) - excludeHeight;
const maxHeight = scrollHeight >= bodyHeight ? bodyHeight : scrollHeight;
bodyStyles.maxHeight = maxHeight;
}
}
styles.bodyStyles = bodyStyles;
handleWindowResize() {
let banner = document.getElementById('banner');
let height = parseInt(getHeight(banner)) - 50;
let indexContent = document.getElementById('index-content');
addStyle(indexContent, 'margin-top', (height < 0 ? 0 : height) + 'px');
},
componentDidMount() {
const headerDOM = node.querySelector(`.${this.addPrefix('header')}`);
const footerDOM = node.querySelector(`.${this.addPrefix('footer')}`);
const contentDOM = node.querySelector(`.${this.addPrefix('content')}`);
headerHeight = headerDOM ? getHeight(headerDOM) + headerHeight : headerHeight;
footerHeight = footerDOM ? getHeight(footerDOM) + headerHeight : headerHeight;
contentHeight = contentDOM ? getHeight(contentDOM) + contentHeight : contentHeight;
if (drawer) {
bodyStyles.height = contentHeight - (headerHeight + footerHeight);
} else {
/**
* Header height + Footer height + Dialog margin
*/
const excludeHeight = headerHeight + footerHeight + 60;
const bodyHeight = getHeight(window) - excludeHeight;
const maxHeight = scrollHeight >= bodyHeight ? bodyHeight : scrollHeight;
bodyStyles.maxHeight = maxHeight;
}
}
styles.bodyStyles = bodyStyles;
return styles;
}
getHeight() {
if (this.barRef.current) {
return getHeight(this.barRef.current);
}
return 0;
}
getHeight() {
if (this.barRef.current) {
return getHeight(this.barRef.current);
}
return 0;
}