Browse Source

Merge pull request #6090 from joecritch/docs-external-link-icon

[Docs] Added icon for external links in nav
main
Jim 9 years ago
parent
commit
adb3d0be2b
  1. 2
      _data/nav_docs.yml
  2. 9
      _plugins/sidebar_item.rb
  3. 16
      css/react.scss
  4. BIN
      img/external.png
  5. BIN
      img/external_2x.png

2
_data/nav_docs.yml

@ -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

9
_plugins/sidebar_item.rb

@ -4,7 +4,14 @@ module Jekyll
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

16
css/react.scss

@ -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 {

BIN
img/external.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
img/external_2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Loading…
Cancel
Save