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

docs: use hambuger for navigation #688

Merged
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
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
angular
.module('gcloud.language-switcher', [])
.directive('languageSwitcher', function() {
.directive('languageSwitcher', function($parse) {
'use strict';

return {
templateUrl: 'site/components/language-switcher/language-switcher.html',
transclude: true,

controller: function($scope) {
link: function($scope, elem, attrs) {
$scope.extraLinks = $parse(attrs.extraLinks)($scope);
$scope.showNavDropdown = false;
}
};
Expand Down
74 changes: 73 additions & 1 deletion docs/site/components/language-switcher/language-switcher.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,78 @@
<nav class="main-nav" ng-class="{ open: showNavDropdown }">
<div class="nav-current" ng-click="showNavDropdown = !showNavDropdown">Node.js</div>
<ul class="menu">
<ul class="menu" ng-click="showNavDropdown = false">

<!-- Getting Started -->
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<h4 class="list-item--heading">Getting Started</h4>
</li>
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<a href="#/authorization" ng-class="{ current: isActiveUrl('/authorization') }" title="Authorization">
Authorization
</a>
</li>
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<a href="#/faq" ng-class="{ current: isActiveUrl('/faq') }" title="Frequently Asked Questions">
FAQ
</a>
</li>
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<a href="#/troubleshooting" ng-class="{ current: isActiveUrl('/troubleshooting') }" title="Troubleshooting">
Troubleshooting
</a>
</li>

<!-- API -->
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<h4 class="list-item--heading">API</h4>
</li>
<li class="menu--extra-links-item invisible-lg"
ng-repeat="page in extraLinks">
<a ng-href="{{page.url}}">
{{page.title}}
</a>
<ul class="sub-sections" ng-if="page.pages">
<li ng-repeat="innerPage in page.pages">
<a ng-href="{{page.url + innerPage.url}}">
{{innerPage.title}}
</a>
</li>
</ul>
</li>

<!-- External -->
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<h4 class="list-item--heading">External Resources</h4>
</li>
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<a href="https://github.com/GoogleCloudPlatform/gcloud-node" title="gcloud-node on Github" class="skip-external-link">
<img src="site/img/icon-link-github.svg" alt="GitHub icon" class="menu-icon" />
GitHub
</a>
</li>
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<a href="https://github.com/GoogleCloudPlatform/gcloud-node/issues" title="gcloud-node issues on Github" class="skip-external-link">
<img src="site/img/icon-link-github.svg" alt="GitHub icon" class="menu-icon" />
Issues
</a>
</li>
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<a href="http://stackoverflow.com/questions/tagged/gcloud-node" title="gcloud-node on StackOverflow" class="skip-external-link">
<img src="site/img/icon-link-stackoverflow.svg" alt="StackOverflow icon" class="menu-icon" />
StackOverflow
</a>
</li>
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<a href="http://npmjs.org/package/gcloud" title="gcloud-node on npm" class="skip-external-link">
<img src="site/img/icon-link-package-manager.svg" alt="npm icon" class="menu-icon" />
npm
</a>
</li>

<!-- Other Languages -->
<li ng-if="extraLinks.length > 0" class="invisible-lg">
<h4 class="list-item--heading">gcloud Libraries</h4>
</li>
<li>
<a href="#" title="gcloud-node Documentation" class="skip-external-link">
<img src="site/img/icon-lang-nodejs-white.svg" alt="gcloud-node" class="menu-icon">
Expand Down
8 changes: 4 additions & 4 deletions docs/site/components/subpage/subpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1 class="logo">
</a>
</h1>

<div language-switcher></div>
<div language-switcher extra-links="{{links}}"></div>

<div class="header--right">
<a href="https://github.com/GoogleCloudPlatform/gcloud-node/issues/new"
Expand Down Expand Up @@ -53,7 +53,7 @@ <h1 class="logo">
</div>
</div>

<ul class="page-sections external-links">
<ul class="page-sections external-links visible-lg">
<li>
<h4 class="list-item--heading">Getting Started</h4>
</li>
Expand All @@ -74,7 +74,7 @@ <h4 class="list-item--heading">Getting Started</h4>
</li>
</ul>

<ul class="page-sections">
<ul class="page-sections visible-lg">
<li>
<h4 class="list-item--heading">API</h4>
</li>
Expand All @@ -96,7 +96,7 @@ <h4 class="list-item--heading">API</h4>
</li>
</ul>

<ul class="external-links">
<ul class="external-links visible-lg">
<li>
<a href="https://github.com/GoogleCloudPlatform/gcloud-node" title="gcloud-node on Github" class="skip-external-link">
<img src="site/img/icon-link-github.svg" alt="GitHub icon" />
Expand Down
134 changes: 87 additions & 47 deletions docs/site/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,12 @@ ul {

.menu {
display: none;
position: absolute;
position: fixed;
top: 3.6em;
right: 0;
width: 100%;
bottom: 0;
overflow-y: auto;
margin: 0;
padding: 0;
background: #2570ec;
Expand Down Expand Up @@ -448,6 +450,26 @@ ul {
background: #1a65e0;
}

.menu .list-item--heading {
padding-left: 1em;
color: #eee;
font-style: italic;
}

.menu--extra-links-item a {
padding: .5em;
padding-left: 1em;
}

.menu--extra-links-item .sub-sections a {
padding-left: 2em;
border-top: 0;
}

.menu--extra-links-item ul {
margin: 0;
}

.menu-icon {
margin-right: 0.5em;
}
Expand Down Expand Up @@ -1202,6 +1224,10 @@ ul {
*zoom: 1;
}

.visible-med {
display: none;
}

.visible-lg {
display: none;
}
Expand Down Expand Up @@ -1276,6 +1302,13 @@ ul {
}

@media only screen and (min-width: 50em) {
.visible-med {
display: block;
}
.invisible-med {
display: none !important;
}

/*
Header
*/
Expand All @@ -1296,7 +1329,10 @@ ul {

.header--right {
top: 20px;
right: 20px;
}

.nav-current {
top: 26px !important;
}

/*
Expand All @@ -1307,56 +1343,11 @@ ul {
width: 280px;
}

/*
Menu
*/

.main-nav {
position: absolute;
top: 1.2em;
left: 21.5em;
}

.page-header.fixed .main-nav {
top: 0;
left: 11.5em;
}

.nav-current {
position: relative;
top: 0;
left: 0;
padding: 0.8em 1.6em;
width: 150px;
height: auto;
border: 1px solid rgba(255,255,255,0.4);
background: url(../img/icon-dropdown.svg) 90% 50% no-repeat;
text-indent: 0;
}

.page-header.fixed .nav-current {
top: 0;
padding: 0 1.6em;
height: 70px;
border: 1px solid rgba(255,255,255,0.2);
border-top: none;
border-bottom: none;
line-height: 70px;
}

.nav-current:hover {
background-color: rgba(255,255,255,0.1);
}

.menu {
top: 3em;
left: 0;
}

.menu a {
padding: 1.2em 1.5em;
}

.page-header.fixed .menu {
top: 70px;
}
Expand Down Expand Up @@ -1412,6 +1403,7 @@ ul {

}


@media only screen and (min-width: 60em) {
.visible-lg {
display: block;
Expand All @@ -1420,6 +1412,54 @@ ul {
display: none !important;
}

/*
Menu
*/
.main-nav {
position: absolute;
top: 1.2em;
left: 21.5em;
}

.page-header.fixed .main-nav {
top: 0;
left: 11.5em;
}

.nav-current {
position: relative;
top: 0 !important;
left: 0;
padding: 0.8em 1.6em;
width: 150px;
height: auto;
border: 1px solid rgba(255,255,255,0.4);
background: url(../img/icon-dropdown.svg) 90% 50% no-repeat;
text-indent: 0;
}

.page-header.fixed .nav-current {
top: 0;
padding: 0 1.6em;
height: 70px;
border: 1px solid rgba(255,255,255,0.2);
border-top: none;
border-bottom: none;
line-height: 70px;
}

.nav-current:hover {
background-color: rgba(255,255,255,0.1);
}

.menu {
bottom: initial;
}

.header--right {
right: 20px;
}

/*
Content
*/
Expand Down