1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-17 06:04:31 +02:00

forgot to localize the hash fragment ids

This commit is contained in:
Pomax
2017-03-07 08:14:26 -08:00
parent aa7bd6290d
commit 9502fba768
10 changed files with 101 additions and 85 deletions

View File

@@ -1,10 +1,19 @@
var React = require("react");
var SectionHeader = React.createClass({
statics: {
locale: ''
},
render: function() {
var locale = SectionHeader.locale;
if (typeof window !== undefined && window.location.toString().indexOf(locale) === -1) {
locale = '';
}
var fragmentid = `${locale ? './' + locale + '/': '.'}#${this.props.name}`;
return (
<h2 id={this.props.name} data-num={this.props.number}>
<a href={'#' + this.props.name}>{this.props.title}</a>
<a href={fragmentid}>{this.props.title}</a>
</h2>
);
},