diff --git a/components/link-anchor-swap.jsx b/components/link-anchor-swap.jsx
index 40f185174..ee55524a0 100644
--- a/components/link-anchor-swap.jsx
+++ b/components/link-anchor-swap.jsx
@@ -1,28 +1,23 @@
var React = require('react');
var Link = require('react-router').Link;
var ga = require('react-ga');
+var classNames = require('classnames');
var OutboundLink = ga.OutboundLink;
var LinkAnchorSwap = React.createClass({
render: function() {
- // FIXME
- // we should find a way to properly intercept external links
- // and render or accordingly as well as their relevant props
- // (icon-link.jsx and icon-button.jsx need to be revisted too)
-
- // Swap out Link or a simple anchor depending on the props we have.
- if (this.props.link) {
- return (
-
- {this.props.children}
-
- )
- }
+ var link = this.props.to;
+ var ifExternalLink = (link.substr(0,4).toLowerCase() === "http") || (link.substr(0,7).toLowerCase() === "mailto:");
+ var classes = classNames(
+ this.props.className,
+ {
+ "external-link": ifExternalLink
+ }
+ );
return (
-
- {this.props.children}
-
- )
+ ifExternalLink ? {this.props.children} :
+ {this.props.children}
+ );
}
});
diff --git a/components/sidebar/TopLevelNavItem.jsx b/components/sidebar/TopLevelNavItem.jsx
index 428e65e5f..8978600a3 100644
--- a/components/sidebar/TopLevelNavItem.jsx
+++ b/components/sidebar/TopLevelNavItem.jsx
@@ -38,7 +38,7 @@ var TopLevelNavItem = React.createClass({
);
return (
-
+