diff --git a/src/App.css b/src/App.css index b41d297ca..75f85ca3c 100755 --- a/src/App.css +++ b/src/App.css @@ -1,33 +1,34 @@ -.App { - text-align: center; +.main { + display: flex; + flex-direction: column; + margin-left: 300px; } -.App-logo { - animation: App-logo-spin infinite 20s linear; - height: 40vmin; - pointer-events: none; + +h1 { + font-size: 60px; } -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; +.RandomButton { + padding: 20px 35px; + background-color: white; + font-size: 20px; + margin: 30px 0px; +} + +table { + width: 700px; +} + +th { + font-size: 30px; + font-weight: 800; } -.App-link { - color: #61dafb; +td{ + font-size: 30px; } -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } +td img{ + width: 100px; } diff --git a/src/App.js b/src/App.js index 7e261ca47..e75d0a567 100755 --- a/src/App.js +++ b/src/App.js @@ -1,25 +1,13 @@ import React, { Component } from 'react'; -import logo from './logo.svg'; +import contacts from './data/contacts.json' +import ContactList from './components/ContactList' import './App.css'; class App extends Component { render() { return (
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
+
); } diff --git a/src/components/ContactList.js b/src/components/ContactList.js new file mode 100644 index 000000000..4b20fe371 --- /dev/null +++ b/src/components/ContactList.js @@ -0,0 +1,52 @@ +import React, { Component } from 'react'; +import RandomButton from './RandomButton'; + +class ContactList extends Component { + + constructor(props){ + super(); + this.state = { + Contacts: props.contacts, + contactsShowed: props.contacts.slice(0,5) + } + } + + addRandomActor = () => { + let contactsShowedCopy = this.state.contactsShowed; + let index = Math.floor(Math.random() * (this.state.Contacts.length - 4) + 4); + contactsShowedCopy.push(this.state.Contacts[index]); + this.state.Contacts.splice(index,1); + this.setState( { contactsShowed: contactsShowedCopy } ); + } + + render() { + + return( + +
+

IronContacts

+ this.addRandomActor()} /> + + + + + + + { + this.state.contactsShowed.map( (oneContact) => { + return ( + + + + + + ); + }) + } +
PictureNamePopularity
{oneContact.name}/{oneContact.name}{oneContact.popularity}
+
+ ); + } +} + +export default ContactList; \ No newline at end of file diff --git a/src/components/RandomButton.js b/src/components/RandomButton.js new file mode 100644 index 000000000..3e0e2342e --- /dev/null +++ b/src/components/RandomButton.js @@ -0,0 +1,13 @@ +import React from 'react'; + + const RandomButton = (props) => { + + return( +
+ +
+ + ); + } + +export default RandomButton; \ No newline at end of file