Skip to content
Snippets Groups Projects
Commit ef28ab26 authored by Martin Wighus Holtmon's avatar Martin Wighus Holtmon
Browse files

projectSecondPart/Problem1 - Added link from userDetail to the users photos (userPhotos)

parent a420cd81
Branches
No related tags found
No related merge requests found
import React from 'react';
import './userDetail.css';
import {Link} from "react-router-dom";
import {Typography} from "@material-ui/core";
/**
......@@ -14,14 +16,15 @@ class UserDetail extends React.Component {
generateUserPreview() {
let user = window.cs142models.userListModel().find(e => e._id === this.props.match.params.userId)
console.log(user)
return (<div id="DivUserPreview">
return (
<Typography variant="body1">
<h2>{user.first_name} {user.last_name}</h2>
<p>
Occupation: {user.occupation} <br />
From: {user.location} <br />
Description: {user.description}
</p>
</div>
</Typography>
)
}
......@@ -30,6 +33,7 @@ class UserDetail extends React.Component {
return (
<div id="divUserDetail">
{this.generateUserPreview()}
<Link to={"/photos/" + this.props.match.params.userId}>See photos!</Link>
</div>
);
}
......
......@@ -11,7 +11,7 @@ import './userPhotos.css';
class UserPhotos extends React.Component {
constructor(props) {
super(props);
console.log(window.cs142models.photoOfUserModel(this.props.match.params.userId))
}
render() {
......
......@@ -4,7 +4,7 @@ import {
HashRouter, Route, Switch
} from 'react-router-dom';
import {
Grid, Typography, Paper
Grid, Paper
} from '@material-ui/core';
import './styles/main.css';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment