Skip to content

Commit

Permalink
Merge pull request #6090 from joecritch/docs-external-link-icon
Browse files Browse the repository at this point in the history
[Docs] Added icon for external links in nav
(cherry picked from commit 8f2b7d8)
  • Loading branch information
jimfb authored and zpao committed Mar 7, 2016
1 parent 3ff62fa commit 5f7f9b1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/_data/nav_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
title: Videos
- id: complementary-tools
title: Complementary Tools
href: https://github.com/facebook/react/wiki/Complementary-Tools
- id: examples
title: Examples
href: https://github.com/facebook/react/wiki/Examples
- title: Guides
items:
- id: why-react
Expand Down
9 changes: 8 additions & 1 deletion docs/_plugins/sidebar_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ def sidebar_item_link(item)
pageID = @context.registers[:page]["id"]
itemID = item["id"]
href = item["href"] || "/react/docs/#{itemID}.html"
className = pageID == itemID ? ' class="active"' : ''
classes = []
if pageID == itemID
classes.push("active")
end
if item["href"]
classes.push("external")
end
className = classes.size ? "class=\"#{classes.join(' ')}\"" : "";

return "<a href=\"#{href}\"#{className}>#{item["title"]}</a>"
end
Expand Down
16 changes: 16 additions & 0 deletions docs/css/react.scss
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,22 @@ h1, h2, h3, h4, h5, h6 {
&.active {
color: $primary;
}

&.external {
&:after {
content: "";
display: inline-block;
width: 10px;
height: 10px;
padding-left: 5px;
@include retina-image('../img/external', 10px 10px);
background-position: 100% 0;
background-repeat: no-repeat;
font-size: 10px;
line-height: 1em;
opacity: 0.5;
}
}
}

.nav-docs-section {
Expand Down
Binary file added docs/img/external.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/external_2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5f7f9b1

Please sign in to comment.