SDA-1510 - Add margin top dynamically in mana (#801)

This commit is contained in:
Kiran Niranjan 2019-11-07 14:09:01 +05:30 committed by GitHub
parent 55d667ab46
commit d6ba2d7a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 7 deletions

View File

@ -52,6 +52,10 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
if (target) {
this.observer.observe(target, { attributes: true, childList: true, subtree: true, characterData: true });
}
setTimeout(() => {
this.updateTitleBar();
}, 10000);
}
public componentWillUnmount(): void {
@ -247,15 +251,29 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
private updateTitleBar(): void {
const { isFullScreen, titleBarHeight } = this.state;
const contentWrapper = document.getElementById('content-wrapper');
if (!contentWrapper) {
const root = document.getElementById('root');
const railContainer = document.getElementsByClassName('ReactRail-container-2')[0] as HTMLElement;
const railList = document.getElementsByClassName('railList')[0] as HTMLElement;
if (railContainer) {
railContainer.style.height = isFullScreen ? '100vh' : `calc(100vh - ${titleBarHeight})`;
} else if (railList) {
railList.style.height = isFullScreen ? '100vh' : `calc(100vh - ${titleBarHeight})`;
}
if (!contentWrapper && !root) {
document.body.style.marginTop = isFullScreen ? '0px' : titleBarHeight;
return;
}
if (root) {
root.style.marginTop = isFullScreen ? '0px' : titleBarHeight;
} else if (contentWrapper) {
contentWrapper.style.marginTop = isFullScreen ? '0px' : titleBarHeight;
}
if (isFullScreen) {
document.body.style.removeProperty('margin-top');
}
document.body.classList.add('sda-title-bar');
}
/**

View File

@ -112,9 +112,7 @@
bottom: 0;
}
body {
sda-title-bar {
.sda-title-bar {
display: flex;
flex-direction: row;
}
}