summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core/src/components/Link.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-core/src/components/Link.js')
-rw-r--r--packages/gitbook-core/src/components/Link.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/packages/gitbook-core/src/components/Link.js b/packages/gitbook-core/src/components/Link.js
index f5b9753..145486e 100644
--- a/packages/gitbook-core/src/components/Link.js
+++ b/packages/gitbook-core/src/components/Link.js
@@ -19,19 +19,16 @@ const Link = React.createClass({
])
},
- getHref() {
- let { currentFile, to } = this.props;
+ render() {
+ const { currentFile, to, children, ...props } = this.props;
+ let href = to;
if (SummaryArticle.is(to) || File.is(to)) {
- to = to.url;
+ href = to.url;
}
- return currentFile.relative(to);
- },
+ href = currentFile.relative(href);
- render() {
- const { children, ...props } = this.props;
- const href = this.getHref();
return <a href={href} {...props}>{children}</a>;
}
});