Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #71 from algolia/fix/misc-front
Browse files Browse the repository at this point in the history
fix(documentation): Different styles tweaks to fit to #54
  • Loading branch information
Vincent Voyer committed Apr 6, 2016
2 parents 9928383 + e94a14d commit cd8ab34
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
20 changes: 20 additions & 0 deletions docs/source/javascripts/documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import './responsive-navigation.js';
demo();
anchorableTitles();
sidebarFollowScroll();
activeLinks();

function demo() {
places({
Expand Down Expand Up @@ -51,3 +52,22 @@ function sidebarFollowScroll() {
}
});
}

// The Following code is used to set active items
// On the documentation sidebar depending on the
// clicked item
function activeLinks() {
const linksContainer = document.querySelector('#sidebar ul');
const removeActive = (item) => {
item.classList.remove('active');
};

linksContainer.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
[].forEach.call(this.children, removeActive);
e.target.parentNode.classList.add('active');
}
});
}


2 changes: 1 addition & 1 deletion docs/source/partials/documentation/sidebar.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- [Getting started](#getting-started)
- [API](#api)
- [Rate limit](#rate-limitf)
- [Rate limit](#rate-limit)
3 changes: 2 additions & 1 deletion docs/source/partials/hero.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
%div.hero-container

%div.fl-left
%span{class: "icon icon-algolia-small no-mobile", id: "icon-algolia"}
%a{href: "http://algolia.com", title:"Link to Algolia webiste"}
%span{class: "icon icon-algolia-small no-mobile", id: "icon-algolia"}
%span{class: "display-on-small small-illustration"}
%img{src: "images/svg/places-illustration.svg"}
%h1= current_page.data.title
Expand Down
10 changes: 9 additions & 1 deletion docs/source/stylesheets/components/_documentation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,22 @@
}

h2, h3 {
padding-bottom: 8px;

.anchor {
color: $red-pink;
text-decoration: none;
}
&:hover {
.anchor {
display: inline;
}
}

&:target {
text-decoration: underline;
.anchor {
display: inline;
}
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions docs/source/stylesheets/components/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ nav.sidebar {

&:focus,
&:target {
color: $red-pink;
box-shadow: inset -2px 0 0 0 $red-pink
@extend %active-links;
}
}

&.active a{
@extend %active-links;
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions docs/source/stylesheets/vendors/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
float: none;
}

%active-links {
color: $red-pink;
box-shadow: inset -2px 0 0 0 $red-pink
}

@mixin big-min-mq {
@media (min-width: $bp-big){
@content
Expand Down

0 comments on commit cd8ab34

Please sign in to comment.