Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong padding for single row mobile nav #1191

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion v1/lib/core/Site.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,30 @@

const React = require('react');
const fs = require('fs');
const classNames = require('classnames');

const HeaderNav = require('./nav/HeaderNav.js');
const Head = require('./Head.js');

const Footer = require(`${process.cwd()}/core/Footer.js`);
const translation = require('../server/translation.js');
const env = require('../server/env.js');
const liveReloadServer = require('../server/liveReloadServer.js');
const {idx} = require('./utils.js');

const CWD = process.cwd();

// Component used to provide same head, header, footer, other scripts to all pages
class Site extends React.Component {
mobileNavHasOneRow(headerLinks) {
const hasLanguageDropdown =
env.translation.enabled && env.translation.enabledLanguages().length > 1;
const hasOrdinaryHeaderLinks = headerLinks.some(
link => !(link.languages || link.search),
);
return !(hasLanguageDropdown || hasOrdinaryHeaderLinks);
}

render() {
const tagline =
idx(translation, [this.props.language, 'localized-strings', 'tagline']) ||
Expand All @@ -43,6 +54,12 @@ class Site extends React.Component {
docsVersion = latestVersion;
}

const navPusherClasses = classNames('navPusher', {
singleRowMobileNav: this.mobileNavHasOneRow(
this.props.config.headerLinks,
),
});

return (
<html lang={this.props.language}>
<Head
Expand All @@ -62,7 +79,7 @@ class Site extends React.Component {
version={this.props.version}
current={this.props.metadata}
/>
<div className="navPusher">
<div className={navPusherClasses}>
{this.props.children}
<Footer config={this.props.config} language={this.props.language} />
</div>
Expand Down
8 changes: 8 additions & 0 deletions v1/lib/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,10 @@ input::placeholder {
z-index: 99;
}

.singleRowMobileNav.navPusher {
padding-top: 50px;
}

.navPusher:after {
background: rgba(0, 0, 0, 0.4);
content: '';
Expand Down Expand Up @@ -1990,6 +1994,10 @@ input::placeholder {
z-index: 10;
}

.tocActive .singleRowMobileNav .onPageNav {
top: 98px;
}

.tocActive .navToggle,
.tocActive .navBreadcrumb h2 {
visibility: hidden;
Expand Down