feat: narrow header content

When in codepage and gitako is ready
This commit is contained in:
EnixCoda 2019-02-19 16:35:12 +08:00
parent f6a87da6eb
commit 861870a0b4
No known key found for this signature in database
GPG key ID: 6825847C88AA329A
3 changed files with 12 additions and 0 deletions

View file

@ -15,7 +15,9 @@
@media (min-width: @width-with-gitako) {
margin-left: 0;
}
}
.@{name}-ready {
.Header > div {
width: 1012px;
margin: 0 auto;

View file

@ -128,6 +128,7 @@ const init: MethodCreator<Props, ConnectorState> = dispatch => async () => {
dispatch.call(setMetaData, metaData)
const shouldShow = URLHelper.isInCodePage(metaData)
dispatch.call(setShouldShow, shouldShow)
DOMHelper.markGitakoReadyState()
} catch (err) {
dispatch.call(handleError, err)
}

View file

@ -7,6 +7,14 @@ import * as NProgress from 'nprogress'
NProgress.configure({ showSpinner: false })
/**
* when gitako is ready, make page's header narrower
*/
function markGitakoReadyState() {
const readyClassName = 'gitako-ready'
document.body.classList.add(readyClassName)
}
/**
* if should show gitako, then move body right to make space for showing gitako
* otherwise, hide the space
@ -355,6 +363,7 @@ export default {
getCurrentPageType,
getRepoPageType,
insertLogoMountPoint,
markGitakoReadyState,
setBodyIndent,
scrollToNodeElement,
scrollToRepoContent,