Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f7f9b1

Browse files
jimfbzpao
authored andcommitted
Merge pull request facebook#6090 from joecritch/docs-external-link-icon
[Docs] Added icon for external links in nav (cherry picked from commit 8f2b7d8)
1 parent 3ff62fa commit 5f7f9b1

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

docs/_data/nav_docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
title: Videos
1515
- id: complementary-tools
1616
title: Complementary Tools
17+
href: https://github.com/facebook/react/wiki/Complementary-Tools
1718
- id: examples
1819
title: Examples
20+
href: https://github.com/facebook/react/wiki/Examples
1921
- title: Guides
2022
items:
2123
- id: why-react

docs/_plugins/sidebar_item.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ def sidebar_item_link(item)
44
pageID = @context.registers[:page]["id"]
55
itemID = item["id"]
66
href = item["href"] || "/react/docs/#{itemID}.html"
7-
className = pageID == itemID ? ' class="active"' : ''
7+
classes = []
8+
if pageID == itemID
9+
classes.push("active")
10+
end
11+
if item["href"]
12+
classes.push("external")
13+
end
14+
className = classes.size ? "class=\"#{classes.join(' ')}\"" : "";
815

916
return "<a href=\"#{href}\"#{className}>#{item["title"]}</a>"
1017
end

docs/css/react.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,22 @@ h1, h2, h3, h4, h5, h6 {
260260
&.active {
261261
color: $primary;
262262
}
263+
264+
&.external {
265+
&:after {
266+
content: "";
267+
display: inline-block;
268+
width: 10px;
269+
height: 10px;
270+
padding-left: 5px;
271+
@include retina-image('../img/external', 10px 10px);
272+
background-position: 100% 0;
273+
background-repeat: no-repeat;
274+
font-size: 10px;
275+
line-height: 1em;
276+
opacity: 0.5;
277+
}
278+
}
263279
}
264280

265281
.nav-docs-section {

docs/img/external.png

1.22 KB
Loading

docs/img/external_2x.png

1.12 KB
Loading

0 commit comments

Comments
 (0)