New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Danny Solis #2
Open
dsolis421
wants to merge
15
commits into
AustinCodingAcademy:master
Choose a base branch
from
dsolis421:master
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Danny Solis #2
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1b7d2e5
initial commit update readme
dsolis421 eb884a3
contact list initial commit
dsolis421 3f4b93e
version test
dsolis421 8cc454e
refactored initial commit
dsolis421 50676f2
refactored app.js
dsolis421 51e01a0
v2 working commit
dsolis421 eb2ebe5
refactor list and contact
dsolis421 67bdc19
spurs contact list
dsolis421 d320946
contact list addin attempt1
dsolis421 8fcde47
refactor contact list
dsolis421 1433463
contact list v4 update
dsolis421 78a51a8
contact list v4 refactor w API
dsolis421 4b285f5
contact list extension wk1
dsolis421 1444362
contact list w extensions v4
dsolis421 012bf28
added react router
dsolis421 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Contact List | ||
|
||
A starter repo for the ACA full stack contact list project. | ||
This is for Danny Solis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,29 @@ | ||
{ | ||
"contacts": [ | ||
{ | ||
"_id": 1, | ||
"name": "Dale Cooper", | ||
"occupation": "FBI Agent", | ||
"avatar": "https://upload.wikimedia.org/wikipedia/en/5/50/Agentdalecooper.jpg" | ||
"name": "Soap McTavish", | ||
"avatar": "http://vignette4.wikia.nocookie.net/callofduty/images/b/b7/Soap_MW3_model.png/revision/latest?cb=20120122010801", | ||
"occupation": "British SAS", | ||
"_id": 6 | ||
}, | ||
{ | ||
"_id": 2, | ||
"name": "Spike Spiegel", | ||
"occupation": "Bounty Hunter", | ||
"avatar": "http://vignette4.wikia.nocookie.net/deadliestfiction/images/d/de/Spike_Spiegel_by_aleztron.jpg/revision/latest?cb=20130920231337" | ||
"name": "Lilith", | ||
"avatar": "http://vignette3.wikia.nocookie.net/talesfromtheborderlands/images/7/7e/Lilith.png/revision/latest?cb=20150722060031", | ||
"occupation": "Siren", | ||
"_id": 8 | ||
}, | ||
{ | ||
"_id": 3, | ||
"name": "Wirt", | ||
"occupation": "adventurer", | ||
"avatar": "http://66.media.tumblr.com/5ea59634756e3d7c162da2ef80655a39/tumblr_nvasf1WvQ61ufbniio1_400.jpg" | ||
"name": "Master Chief", | ||
"avatar": "http://img.mota.ru/upload/wallpapers/2011/05/30/10/04/25864/mota_ru_1053028-preview.jpg", | ||
"occupation": "Spartan", | ||
"_id": 10 | ||
}, | ||
{ | ||
"_id": 4, | ||
"name": "Michael Myers", | ||
"occupation": "Loving little brother", | ||
"avatar": "http://vignette2.wikia.nocookie.net/villains/images/e/e3/MMH.jpg/revision/latest?cb=20150810215746" | ||
}, | ||
{ | ||
"_id": 5, | ||
"name": "Dana Scully", | ||
"occupation": "FBI Agent", | ||
"avatar": "https://pbs.twimg.com/profile_images/718881904834056192/WnMTb__R.jpg" | ||
"name": "Cortana", | ||
"avatar": "https://content.halocdn.com/media/Default/encyclopedia/characters/cortana/cortana-square-542x542-0234af18940e48b1827c1423b5a8ed40-620b1e678f634dd099bba9f3533c560d.jpg", | ||
"occupation": "AI", | ||
"_id": 9 | ||
} | ||
] | ||
} | ||
], | ||
"favorites": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"contacts": [ | ||
{ | ||
"_id": 1, | ||
"name": "Dale Cooper", | ||
"occupation": "FBI Agent", | ||
"avatar": "https://upload.wikimedia.org/wikipedia/en/5/50/Agentdalecooper.jpg" | ||
}, | ||
{ | ||
"_id": 2, | ||
"name": "Spike Spiegel", | ||
"occupation": "Bounty Hunter", | ||
"avatar": "http://vignette4.wikia.nocookie.net/deadliestfiction/images/d/de/Spike_Spiegel_by_aleztron.jpg/revision/latest?cb=20130920231337" | ||
}, | ||
{ | ||
"_id": 3, | ||
"name": "Wirt", | ||
"occupation": "adventurer", | ||
"avatar": "http://66.media.tumblr.com/5ea59634756e3d7c162da2ef80655a39/tumblr_nvasf1WvQ61ufbniio1_400.jpg" | ||
}, | ||
{ | ||
"_id": 4, | ||
"name": "Michael Myers", | ||
"occupation": "Loving little brother", | ||
"avatar": "http://vignette2.wikia.nocookie.net/villains/images/e/e3/MMH.jpg/revision/latest?cb=20150810215746" | ||
}, | ||
{ | ||
"_id": 5, | ||
"name": "Dana Scully", | ||
"occupation": "FBI Agent", | ||
"avatar": "https://pbs.twimg.com/profile_images/718881904834056192/WnMTb__R.jpg" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
|
||
const Activity = props => { | ||
return ( | ||
<div className="activity-log"> | ||
<h4>Recent Activity</h4> | ||
<ul className="activity-items"> | ||
{props.activity.length > 0 ? props.activity.map(action => { | ||
return <li>{action}</li> | ||
}) : <li>No activity</li>} | ||
</ul> | ||
</div> | ||
) | ||
} | ||
|
||
export default Activity; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
class Contact extends React.Component { | ||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
confirmDelete: false | ||
}; | ||
} | ||
|
||
render() { | ||
return ( | ||
<Link to={`/profile/${this.props.id}`} className="contact-link"> | ||
<li className="contact"> | ||
<div className="image-cropper"> | ||
<img src={this.props.avatar} alt="avatar"/> | ||
</div> | ||
{this.state.confirmDelete ? <div className="contact-alert"> | ||
<h3>Delete this contact? <span onClick={() => this.props.handleDelete(this.props.id, this.props.listName.toString().toLowerCase())}>Yes</span> / <span onClick={() => this.setState({confirmDelete: false})}>No</span></h3> | ||
</div> : <div className="contact-info"> | ||
<h2>{this.props.name}</h2> | ||
{this.props.occupation} | ||
</div> | ||
} | ||
|
||
<div className="add-start" onClick={() => this.props.handleFav(this.props.id)}> | ||
<span className={this.props.buttonText}></span> | ||
</div> | ||
<div className="add-start" onClick={() => this.setState({confirmDelete: true})}> | ||
<span className="fa fa-minus-square"></span> | ||
</div> | ||
</li> | ||
</Link> | ||
); | ||
} | ||
} | ||
|
||
Contact.propTypes = { | ||
id: React.PropTypes.number.isRequired, | ||
avatar: React.PropTypes.string.isRequired, | ||
name: React.PropTypes.string.isRequired, | ||
occupation: React.PropTypes.string.isRequired, | ||
} | ||
|
||
export default Contact; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React from 'react'; | ||
|
||
class ContactForm extends React.Component { | ||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
name: '', | ||
avatar: '', | ||
occupation: '' | ||
} | ||
} | ||
|
||
handleNameChange(event) { | ||
this.setState({ | ||
name: event.target.value | ||
}); | ||
} | ||
|
||
handleOccupationChange(event) { | ||
this.setState({ | ||
occupation: event.target.value | ||
}); | ||
} | ||
|
||
handleAvatarChange(event) { | ||
this.setState({ | ||
avatar: event.target.value | ||
}); | ||
} | ||
|
||
handleSubmit(event) { | ||
event.preventDefault(); | ||
|
||
const { name, avatar, occupation } = this.state; | ||
this.props.onSubmit({ name, avatar, occupation }, 'contacts'); | ||
|
||
this.setState({ | ||
name: '', | ||
avatar: '', | ||
occupation: '' | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div id="form-container"> | ||
<span className="fa fa-remove" onClick={() => this.props.hideForm()}></span> | ||
<form className="new-contact-form" onSubmit={this.handleSubmit.bind(this)}> | ||
|
||
<input | ||
type="text" | ||
name="name" | ||
placeholder="Name" | ||
value={this.state.name} | ||
onChange={this.handleNameChange.bind(this)} | ||
/> | ||
|
||
<input | ||
type="text" | ||
name="occupation" | ||
placeholder="Occupation" | ||
value={this.state.occupation} | ||
onChange={this.handleOccupationChange.bind(this)} | ||
/> | ||
|
||
<input | ||
type="text" | ||
name="avatar" | ||
placeholder="Avatar (link)" | ||
value={this.state.avatar} | ||
onChange={this.handleAvatarChange.bind(this)} | ||
/> | ||
|
||
<input | ||
type="submit" | ||
value="+ Add New" | ||
disabled={!this.state.name.trim() || !this.state.occupation.trim() || !this.state.avatar.trim()} | ||
/> | ||
</form> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
ContactForm.propTypes = { | ||
onSubmit: React.PropTypes.func.isRequired | ||
}; | ||
|
||
export default ContactForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import Contact from './Contact'; | ||
|
||
const ContactList = props => { | ||
return ( | ||
<div className="contact-container"> | ||
<ul className="contact-list"> | ||
<h1>{props.listName}</h1> | ||
{props.contacts.length > 0 ? | ||
props.contacts.map(contact => { | ||
return ( | ||
<Contact | ||
key={contact._id} | ||
id={contact._id} | ||
name={contact.name} | ||
avatar={contact.avatar} | ||
occupation={contact.occupation} | ||
buttonText={props.buttonText} | ||
handleFav={props.handleFav} | ||
handleDelete={props.handleDelete} | ||
listName={props.listName} | ||
/> | ||
) | ||
}) : <h3>No {props.listName.toString().toLowerCase()}</h3>} | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
export default ContactList; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would like to see |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to see the use of
propTypes
here