Skip to content

Commit

Permalink
intelliware-coe-web#6 - Added user profile component with stubbed state
Browse files Browse the repository at this point in the history
  • Loading branch information
chetna-pannu committed Jul 16, 2018
1 parent 254e8ee commit 39cfb2b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import UserProfile from './UserProfile';

class App extends Component {
render() {
Expand All @@ -13,6 +14,7 @@ class App extends Component {
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
<UserProfile />
</div>
);
}
Expand Down
33 changes: 33 additions & 0 deletions src/UserProfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { Component } from 'react';

class UserProfile extends Component {
constructor(props) {
super(props);
this.state = {
username: 'Jane Doe',
createdDate: '2015-06-31',
description: 'Amazing user',
numOfStories: 5,
};
}

render() {
let stories;
if (this.state.numOfStories > 0) {
stories = 'Number of stories submitted: ' + this.state.numOfStories;
} else {
stories = 'No stories submitted yet'
}

return (
<div className="UserProfile">
<p>Username: {this.state.username}</p>
<p>Created Date: {this.state.createdDate}</p>
<p>Description: {this.state.description}</p>
<p>{stories}</p>
</div>
);
}
}

export default UserProfile;

0 comments on commit 39cfb2b

Please sign in to comment.