Refactor GitHub update-layout

This commit is contained in:
Buu Nguyen 2015-11-25 13:02:24 -08:00
parent b349180b90
commit 9e3eef2fff
1 changed files with 5 additions and 5 deletions

View File

@ -106,13 +106,13 @@ class GitHub extends Adapter {
// @override
updateLayout(togglerVisible, sidebarVisible, sidebarWidth) {
const SPACING = 10
const sidebarWidthWithSpace = sidebarWidth + 10
const $containers = $(GH_CONTAINERS)
const autoMarginLeft = ($(document).width() - 980) / 2
const shouldPushLeft = sidebarVisible && (autoMarginLeft <= sidebarWidth + SPACING)
const autoMarginLeft = ($(document).width() - $containers.width()) / 2
const shouldPushContent = sidebarVisible && (autoMarginLeft <= sidebarWidthWithSpace)
$('html').css('margin-left', shouldPushLeft ? sidebarWidth : '')
$containers.css('margin-left', shouldPushLeft ? SPACING : '')
$('html').css('margin-left', shouldPushContent ? sidebarWidthWithSpace : '')
$containers.css('margin-left', shouldPushContent ? 0 : '')
}
// @override