Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"dependencies": {
"react": "^16.8.1",
"react-dom": "^16.8.1",
"react-scripts": "2.1.5"
"react-scripts": "2.1.5",
"short-id": "0.1.0-1"
},
"scripts": {
"start": "react-scripts start",
Expand Down
17 changes: 17 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.App {
text-align: center;

}

.App-logo {
Expand All @@ -23,6 +24,22 @@
color: #61dafb;
}

.App table{
width: 50%;
max-width: 900px;
margin: 0 auto;
}
.App table td{
width: 10%;
}
.App table td img{
width: 100%;
transition: all 300ms;
}
.App table td img:hover{
transform: scale(1.1) rotate(-5deg);
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
Expand Down
58 changes: 42 additions & 16 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import contacts from './data/contacts.json';

const ContactList = contacts.slice(0,5);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why capital letter? They look like components but they are not

const RandomContact = contacts[Math.floor(Math.random()*contacts.length)];
ContactList.push(RandomContact)

const ContactListFinal = ContactList.map((contact, index) =>
<tr key={index}>
<td ><img src={contact.pictureUrl}/></td>
<td >{contact.name}</td>
<td >{contact.popularity}</td>
</tr>
);


class App extends Component {

state={
contacts : ContactListFinal
}

DeleteAll = () => {
this.setState({ contacts: [] });
}
RandomActor = () => {
/* this.setState({ contacts: ContactListFinal }); */
}

render() {

return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<h1>IRONCONTACTS</h1>
<button onClick={this.RandomActor}>Add Random Contact</button>
<table>
<thead>
</thead>
<tbody>
<tr>
<th>Picture</th>
<th>Name</th>
<th>Popularity</th>
</tr>
{this.state.contacts}
</tbody>
</table>
</div>
);
}
}

}
export default App;