|
@@ -6,6 +6,7 @@ const USER_DATA = {
|
|
|
|
|
|
let React = require("react");
|
|
let React = require("react");
|
|
let ReactDOM = require("react-dom");
|
|
let ReactDOM = require("react-dom");
|
|
|
|
+import routes from "../config/routes";
|
|
|
|
|
|
/* React components should be:
|
|
/* React components should be:
|
|
|
|
|
|
@@ -25,11 +26,28 @@ let ProfilePic = React.createClass({
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+let Link = React.createClass({
|
|
|
|
+ changeURL() {
|
|
|
|
+ console.log(this.props.href);
|
|
|
|
+ window.location.replace(this.props.href);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ render() {
|
|
|
|
+ return (
|
|
|
|
+ <span
|
|
|
|
+ style={ { color: "blue", cursor: "pointer" } }
|
|
|
|
+ onClick={this.changeURL}>
|
|
|
|
+ {this.props.children}
|
|
|
|
+ </span>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
let ProfileLink = React.createClass({
|
|
let ProfileLink = React.createClass({
|
|
render: function () {
|
|
render: function () {
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
- <a href={"https://github.com/" + this.props.username}>{this.props.username}</a>
|
|
|
|
|
|
+ <Link href={"https://github.com/" + this.props.username}>{this.props.username}</Link>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -49,14 +67,14 @@ let Avatar = React.createClass({
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
<ProfilePic imageUrl={user.image} />
|
|
<ProfilePic imageUrl={user.image} />
|
|
- <ProfileLink username={user.username} />
|
|
|
|
<ProfileName name={user.name} />
|
|
<ProfileName name={user.name} />
|
|
|
|
+ <ProfileLink username={user.username} />
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
ReactDOM.render(
|
|
ReactDOM.render(
|
|
- <Avatar user={USER_DATA} />,
|
|
|
|
|
|
+ routes,
|
|
document.getElementById("app")
|
|
document.getElementById("app")
|
|
);
|
|
);
|