From 7b9a4ef862c60ceee64d42aa9fe0ba4cac51e687 Mon Sep 17 00:00:00 2001 From: Titouan Rigoudy Date: Tue, 24 May 2016 16:31:22 +0200 Subject: [PATCH] Add basic User component. --- src/components/User.js | 22 ++++++++++++++++++++++ src/components/UserList.js | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/components/User.js diff --git a/src/components/User.js b/src/components/User.js new file mode 100644 index 0000000..bc969cb --- /dev/null +++ b/src/components/User.js @@ -0,0 +1,22 @@ +import React, { PropTypes } from "react"; +import { Link } from "react-router"; +import md5 from "md5"; + +const User = ({ name }) => { + const path = `/app/users/${md5(name)}`; + + return ( + + {name} + + ); +}; + +User.propTypes = { + name: PropTypes.string.isRequired +}; + +export default User; diff --git a/src/components/UserList.js b/src/components/UserList.js index 8fc3650..ca8068e 100644 --- a/src/components/UserList.js +++ b/src/components/UserList.js @@ -1,6 +1,8 @@ import React, { PropTypes } from "react"; import ImmutablePropTypes from "react-immutable-proptypes"; +import User from "./User"; + class UserList extends React.Component { constructor(props) { super(props); @@ -19,7 +21,7 @@ class UserList extends React.Component { for (const [ userName, userData ] of users.byName) { children.push(
  • - {userName} +
  • ); }