-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ChartView: Skip comments and render hash links (#1476)
- Loading branch information
Andres Martinez Gotor
authored
Jan 23, 2020
1 parent
94a9617
commit b97cbd8
Showing
5 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from "react"; | ||
import { HashLink as Link } from "react-router-hash-link"; | ||
|
||
const LinkRenderer: React.SFC<{}> = (props: any) => { | ||
if (props.href.startsWith("#")) { | ||
return <Link to={props.href}>{props.children}</Link>; | ||
} | ||
// If it's not a hash link it's an external link since it's rendering | ||
// the chart README. Because of that, render it as a normal anchor | ||
return <a href={props.href}>{props.children}</a>; | ||
}; | ||
|
||
export default LinkRenderer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters