Commit 94e2989d authored by Martin Wighus Holtmon's avatar Martin Wighus Holtmon
Browse files

projectSecondPart/Problem1: made userDetails display basic information about the selected user.

parent 7ccc5521
import React from 'react';
import {
} from '@material-ui/core';
import './userDetail.css';
......@@ -11,17 +8,29 @@ import './userDetail.css';
class UserDetail extends React.Component {
constructor(props) {
generateUserPreview() {
let user = window.cs142models.userListModel().find(e => e._id === this.props.match.params.userId)
return (<div id="DivUserPreview">
<h2>{user.first_name} {user.last_name}</h2>
Occupation: {user.occupation} <br />
From: {user.location} <br />
Description: {user.description}
render() {
return (
<Typography variant="body1">
This should be the UserDetail view of the PhotoShare app. Since
it is invoked from React Router the params from the route will be
in property match. So this should show details of user:
{this.props.match.params.userId}. You can fetch the model for the
user from window.cs142models.userModel(userId).
<div id="divUserDetail">
......@@ -15,7 +15,7 @@ import {Link} from "react-router-dom";
class UserList extends React.Component {
constructor(props) {
renderUsers() {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment